The answer is the Observer design pattern. So the question is “How can an object (the model in our case) notify other objects of state changes without being dependent on their classes?”. A better solution will be registering for model update events and being notified whenever the model is updated. But it will consume lots of cpu cycles needlessly if the model is not updated very often. How do we update the View (user interface) when a Model (data) is changed? The View can query the model periodically and if something has changed updates itself. MVC helps us decouple views from the rest of the application, so we can change the user interface without changing any model or logic in our app. We are using Model View Controller (MVC) architectural pattern to build mobile apps and games.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |