Chapter 20. Ten Ways to Be a Happy Developer

In This Chapter

  • Limiting dependencies to what objects do, not how they do it

  • Creating code that is easy to understand

  • Following memory management rules

  • Initializing the right way

  • Using the documentation

  • Practicing your coding

  • Understanding the development process

  • Trying to get it right the first time

  • Knowing what's important — that the software works

  • Planning ahead to extend your code

  • Keeping it fun

I really like writing software. When I first started I couldn't believe that they would actually pay me to do something that was so much fun (believe me, I quickly got over that). Along the way I've learned a few ways make my life as a developer easier.

Keep Everyone in the Dark

One of the things that can really cause you problems as you develop your application is building into your code "detailed" knowledge about how things in your program work. This ranges from data structures, to instance variable visibility (to other objects), to how methods work, to the basic structure of the program. As I spoke about more than once, you want to make sure you keep your objects as ignorant as you can about their environment. While there will always be some dependency whenever one object uses another, limit those dependencies to what other objects do rather than to how they do it, and limit the number of objects each one uses.

Similarly, avoid the compulsion to create switch statement–like control structures that determine the order in which objects get called and that ...

Get Objective-C® 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.