• RSS
Latest Post
Loading...

Tuesday, April 29, 2014

How to Use Design Patterns to Develop an iOS App

in How to
When it comes to iOS app development, the framework does a lot of the heavy lifting for you. That’s all well and good, but working with that framework is a little more complicated than just letting it do its work on its own. The framework is designed around certain programming paradigms, also known as design patterns. The design pattern is a model that your own code must be consistent with.

To understand how to take best advantage of the power of frameworks — or (better put), figuring out how the framework objects want to best use your code — you need to understand design patterns. If you don’t understand them or if you try to work around them because you’re sure that you have a “better” way of doing things, your job will actually end up being much more difficult.

Getting a handle on the basic design patterns that the framework uses (and expects) will help you develop an app that makes the best use of the framework. This means doing the least amount of work in the shortest amount of time.

The design patterns can help you to understand not only how to structure your code but also how the framework itself is structured. They describe relationships and interactions between classes or objects, as well as how responsibilities should be distributed among classes, so that the iOS device does what you want it to do.

In programming terms, a design pattern is a commonly used template that gives you a consistent way to get a particular task done.

To develop an iOS app, you need to be comfortable with the following basic design patterns:
  • Model-View-Controller (MVC)
  • Delegation
  • Block Objects
  • Target-Action
  • Managed Memory Model
Of these, the Model-View-Controller design pattern is the key to understanding how an iPad or iPhone app works.

Another basic design pattern exists as well: Threads and Concurrency. This pattern enables you to execute tasks concurrently (including the use of Grand Central Dispatch, that aiding-and-abetting feature introduced in OS X Snow Leopard for taking full advantage of all that processing power available, even on the smaller iPad and much smaller iPhone).

Particularly with the advent of 64-bit multi-core processors in some of the iOS devices, the ability to use that power with tools such as Grand Central Dispatch is increasingly important.

Source : dummies