01.02.2014 Views

Objective-C Fundamentals

Objective-C Fundamentals

Objective-C Fundamentals

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

94 CHAPTER 4 Storing data in collections<br />

4.5 Summary<br />

Object-oriented programming, as implemented by <strong>Objective</strong>-C, has many advantages<br />

to the application developer over procedural-based languages such as C. The ability to<br />

combine data with logic means that you can encapsulate common functionality and<br />

avoid developing the same algorithms for enumeration, searching, and other actions<br />

in each application you develop. This enables you to concentrate on differentiating<br />

your product and to avoid common types of bugs. Nothing comes for free, however,<br />

and you’ve seen a number of limitations where the procedural world meets the objectoriented,<br />

such as the challenges of testing for object equality or storing values of primitive<br />

data types such as int in an object.<br />

By using the reusable classes provided by Foundation Kit, you were quickly able to<br />

modify the Rental Manager application from being hardcoded to being a dynamic<br />

and rather easily modified application. Rather than requiring code changes to alter<br />

the city-to-image mappings, the updated version, which uses an NSDictionary, can<br />

easily be updated from a plist, a file on the internet, or any other source the developer’s<br />

imagination dreams up.<br />

In chapter 5, we cover some of the more technical aspects of <strong>Objective</strong>-C by learning<br />

how you can define and implement your own classes. You do this by turning the<br />

RentalProperty structure into an <strong>Objective</strong>-C class, so your sample application is<br />

truly object oriented. This is the last major C-style holdover left in your Rental Manager<br />

application.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!