O'Reilly logo

Cocoa® Programming for Mac OS® X For Dummies® by Erick Tejkowski

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required