model view controller - Where is logic/behavior placed in when using an MVC pattern? -
assume friend , writing chess-game android , want use mvc pattern.
i have no experience mvc pattern, , not sure implement core logic , ui behavior.
where must logic located (such validating , making move)?
where must ui behaviors located (such animating game board , pieces)?
model = data objects represent game (such player info, board, pieces , scores, virtually no logic/behavior)
view = ui elements, ui behaviors (such animations, updating graphics, etc) - nothing qualifies business logic, state management, nor persistence. views "reactive" , "interactive" meaning change based on model changes, , user uses them interact 1 or more controllers.
controller = validation, logic, model/state management, persistence, etc. controller expose methods view can invoke actions (such moving peice). upon invoking these action methods model may change, in response model changes view should update (usually through data-binding, event, well-known registered interface or callback method.
Comments
Post a Comment