Open hopewise opened 9 years ago
Dear Samir, Thanks a lot my friend I really appreciate concerns Your such a good friend May Allah spread his kindness over you And bless you and your family On 27 Feb 2015 08:43, "Samir Sabri" notifications@github.com wrote:
Salam Ahmad,
That's good: var myPlayerModel:PlayerModel = new PlayerModel()
That's not good: var myPlayerView:PlayerView = new PlayerView(myPlayerModel, myPlayerControl);
View should not know about the model, and controller, view just emit events. The controller will know about the current view by listening to its events.
How would the controller know about the viewer? You should add something like that:
myPlayerControl.setView (myPlayerView);
the controller will expect an object that implements IPlayerView interface in the controller:
public function setView (aView: IPlayerView){ // add event listeners to aView, you might need to cast it // assign current view property to aView }
In general, view should be able to handle all the logic that is related to its graphics, buttons, slider bars.. etc ..
I advice you to read MVC at this book: http://shop.oreilly.com/product/9780596528461.do
And if you like, there is a common concept, that is dependency injection, read here: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8#q=as3+dependency+injectio
Good luck my brother, few people care about code quality, specially when you work with managers that has nothing to do with programming ..
Views should be easily plugged, and unplugged into controller.. so they should be loosely coupled
And last advice, move to haxe
— Reply to this email directly or view it on GitHub https://github.com/jadzeino/theNewOSMFplayer/issues/1.
لا شكر على واجب:) زكاة العلم.. On Feb 27, 2015 3:39 PM, "jadzeino" notifications@github.com wrote:
Dear Samir, Thanks a lot my friend I really appreciate concerns Your such a good friend May Allah spread his kindness over you And bless you and your family On 27 Feb 2015 08:43, "Samir Sabri" notifications@github.com wrote:
Salam Ahmad,
That's good: var myPlayerModel:PlayerModel = new PlayerModel()
That's not good: var myPlayerView:PlayerView = new PlayerView(myPlayerModel, myPlayerControl);
View should not know about the model, and controller, view just emit events. The controller will know about the current view by listening to its events.
How would the controller know about the viewer? You should add something like that:
myPlayerControl.setView (myPlayerView);
the controller will expect an object that implements IPlayerView interface in the controller:
public function setView (aView: IPlayerView){ // add event listeners to aView, you might need to cast it // assign current view property to aView }
In general, view should be able to handle all the logic that is related to its graphics, buttons, slider bars.. etc ..
I advice you to read MVC at this book: http://shop.oreilly.com/product/9780596528461.do
And if you like, there is a common concept, that is dependency injection, read here:
Good luck my brother, few people care about code quality, specially when you work with managers that has nothing to do with programming ..
Views should be easily plugged, and unplugged into controller.. so they should be loosely coupled
And last advice, move to haxe
— Reply to this email directly or view it on GitHub https://github.com/jadzeino/theNewOSMFplayer/issues/1.
— Reply to this email directly or view it on GitHub https://github.com/jadzeino/theNewOSMFplayer/issues/1#issuecomment-76395440 .
Salam Ahmad,
That's good: var myPlayerModel:PlayerModel = new PlayerModel()
That's not good: var myPlayerView:PlayerView = new PlayerView(myPlayerModel, myPlayerControl);
View should not know about the model, and controller, view just emit events. The controller will know about the current view by listening to its events.
How would the controller know about the viewer? You should add something like that:
myPlayerControl.setView (myPlayerView);
the controller will expect an object that implements IPlayerView interface in the controller:
public function setView (aView: IPlayerView){ // add event listeners to aView, you might need to cast it // assign current view property to aView }
In general, view should be able to handle all the logic that is related to its graphics, buttons, slider bars.. etc ..
I advice you to read MVC at this book: http://shop.oreilly.com/product/9780596528461.do
And if you like, there is a common concept, that is dependency injection, read here: https://www.google.com/webhp?sourceid=chrome-instant&ion=1&espv=2&es_th=1&ie=UTF-8#q=as3+dependency+injectio
Good luck my brother, few people care about code quality, specially when you work with managers that has nothing to do with programming ..
Views should be easily plugged, and unplugged into controller.. so they should be loosely coupled
And last advice, move to haxe