Hi :) cool that you sign up here.
So, what I would change if possible, I would rather pass to the constructor of ManuModel the MenuReader, and let the Presenter create the menureader. It's always good to think that you data provider can change so would be cool to create a public interface MenuReader with the methods that are mandatory, and create implementations, like ManuReaderFileStrategy implements MenuReader ( http://www.tutorialspoint.com/design_pattern/strategy_pattern.htm).
Another important advise is always prefer interfaces over implementation, so I would use List<MenuItem> instate ArrayList<MenuItem> in the signature of the methods :). because you could want to change the implementation of the list.
If you can change the MenuReader I would create a static factory to return a menu reader that reads from Menu.txt, something like
publis static MenuReader getDeafultReader(), than this guys internally make new MenuReader('Menu.txt') :)
And finally I would take of the attribute fileName from MenuModel, sinse it does not need to use anymore.
Doing all this your code would look like this -> https://codepad.co/snippet/tFppluyU
I think the rest is awesome :)
If you have any futher queestions you always can reach me by my e-mail kim.ae09@gmail.com
I hope I've helped
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.
1 Response
So, what I would change if possible, I would rather pass to the constructor of ManuModel the MenuReader, and let the Presenter create the menureader. It's always good to think that you data provider can change so would be cool to create a public interface MenuReader with the methods that are mandatory, and create implementations, like ManuReaderFileStrategy implements MenuReader ( http://www.tutorialspoint.com/design_pattern/strategy_pattern.htm).
Another important advise is always prefer interfaces over implementation, so I would use List<MenuItem> instate ArrayList<MenuItem> in the signature of the methods :). because you could want to change the implementation of the list.
If you can change the MenuReader I would create a static factory to return a menu reader that reads from Menu.txt, something like
publis static MenuReader getDeafultReader(), than this guys internally make new MenuReader('Menu.txt') :)
And finally I would take of the attribute fileName from MenuModel, sinse it does not need to use anymore.
Doing all this your code would look like this -> https://codepad.co/snippet/tFppluyU
I think the rest is awesome :)
If you have any futher queestions you always can reach me by my e-mail kim.ae09@gmail.com
I hope I've helped
Write a comment
You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.