Chapter 2. Thinking like an iPhone developer
This chapter covers
- Model-view-controller
- Object-oriented programming
- Object lifetime
There’s only so much you can do with Xcode and Interface Builder without code, but before we get to Objective-C, you need to know more about how iPhone apps are structured. Once you understand that, it will be easier to understand how to code your app. Think of this as the part of The Karate Kid where Miyagi has Daniel painting fences and waxing floors. Or when Yoda makes Luke carry him through the swamps of Dagobah. Or maybe you’re more of a Sound of Music fan. If so, let’s start at the very beginning.
When Maria danced through the streets of Salzburg with the von Trapp children, she taught them how to sing using the song “Do-Re-Mi.” Similarly, iPhone development can best be understood with the letters M-V-C. MVC, or model-view-controller, is a common way of thinking about apps and is used by web programmers, Windows and Mac programmers, and mobile app programmers (like us). It’s useful for any application that has a user interface.