Chapter 2. The Real Truth about Object-Oriented Programming
In This Chapter
Recognizing the importance of modules
Getting a handle on objects
Understanding inheritance
Implementing inheritance
Understanding the connection between inheritance and polymorphism
Seeing encapsulation and polymorphism in action
Understanding the Model-View-Controller pattern
Refining the idea of "reusable code"
Albert Einstein once said that technological change is like an axe in the hands of a pathological criminal. Often a little change or bug-fix in one part of your program can have a disastrous impact on the rest of it. (Co-author Neal remembers a fellow programmer once lamenting, "but I only changed one line of code," after making changes to a program and then putting it into production without adequate testing — only to have it take down an entire mainframe complex.)
To minimize the side effects of "only changing one line of code," you need to divide your programs into modules so that a change you make in one module won't have an impact on the rest of your code. I refer to this Not-Rocking-the-Boat aspect of good code design as transparency.
A module is simply a self-contained, or independent, unit that can be combined with other units to get the job done. Modules are the solution to a rather knotty problem — even a simple program can run into hundreds of lines of instructions, and you need a way to break them into parts to make them understandable. But more importantly, you want to use modules because they ...
Get iPhone® Application Development All-In-One 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.