MVC – The King of Design Patterns
Model View Controller (MVC) is one of the building blocks of Cocoa and is undoubtedly the most-used design pattern of all. It classifies objects according to their general role in your application and encourages clean separation of code based on role.
The three roles are:
- Model: The object that holds your application data and defines how to manipulate it. For example, in your application the Model is your
Album
class. - View: The objects that are in charge of the visual representation of the Model and the controls the user can interact with; basically, all the
UIView
s and their subclasses. In your application the View is represented by yourAlbumView
class. - Controller: The controller is the mediator that coordinates all the work. It accesses the data from the model and displays it with the views, listens to events and manipulates the data as necessary. Can you guess which class is your controller? That’s right:
ViewController
.

Comments
Post a Comment