Chapter 7. MVC Design

If you read Chapter 6, you looked at some of the basics of object-oriented programming with Cocoa. You examined how to define a class and how to create an object with that class. Along the way, I promised that this would make programming simpler and, more importantly, reusable.

Sure, you can make classes and objects all day long, but how do they actually fit together to make an application? This chapter takes object-oriented programming to the next level and shows you at a more abstract level how to design an application with all these classes. A thoughtful Cocoa programmer doesn't just throw a bunch of classes together and come out on the other side with a masterpiece. Instead, a Cocoa programmer thinks about how the various parts of an application work together and then designs the application using the famous Model-View-Controller (MVC) design pattern.

Note

By following this design pattern, you can build applications that are modular, easier to read, and consist of components that you can reuse in other applications. One of the great benefits of object-oriented programming is the ability to reuse code. By reusing code, you can reduce the amount of time you need to spend programming, reduce the number of bugs you have in your code, and ultimately create better software. All is not necessarily smiles and sunshine when it ...

Get Cocoa® Programming for Mac OS® X For Dummies® now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.