Jonathan Cusick

iPhone Development: MVC Design Pattern

If you are planning on developing applications for the iPhone chances are you will be familiar with object oriented programming. Design patterns promote code and design reuse along with making an entire application easier to understand and why a certain structure was adopted.

It is important to note that a design pattern is not a blueprint for an application that just has to be written in your development language of choice, but rather a blueprint for how to implement your code in order to enable stronger code maintainability, testing and to avoid a wide range of issues that could otherwise occur with unstructured (spaghetti) code.

The iPhone platform makes use of the Model View Controller (MVC) design pattern.

    Model – Manages the data for the application and how the state of the data should be updated.

    View – Will handle how the data is displayed on the screen.

    Controller – Deals with the inputs from the user such as utilising all the available on screen elements such as buttons and keyboard functions.

With the MVC design pattern it means that when developing for the iPhone you will have a better way of maintaining and testing your applications. Overall this should mean that better quality applications are created.

MVC-JC2

On a side note I used Balsamiq Mockups to create the above diagram, I would highly recommend giving it a try. This has quickly become one of my favourite applications.

Updated: Diagram updated to show two way relationship between model and view (well spotted by David Rice)

Category: Apple, Code, Design, Development, Geek, Mac, OS X, Software, Technology

Tagged:

Leave a Reply