Monday, March 21, 2011

iPhone/iPad design patterns

Design Patterns
design pattern is a general reusable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. It is a description or template for how to solve a problem that can be used in many different situations. Object-oriented design patterns typically show relationships and interactions between classes or objects, without specifying the final application classes or objects that are involved. Many patterns imply object-orientation or more generally mutable state, and so may not be as applicable in functional programming languages, in which data is immutable or treated as such.

The Model-View-Controller (MVC) design pattern is a way of dividing your code into independent functional areas. The model portion defines your application’s underlying data engine and is responsible for maintaining the integrity of that data. The view portion defines the user interface for your application and has no explicit knowledge of the origin of data displayed in that interface. The controller portion acts as a bridge between the model and view and facilitates updates between them.
The delegation design pattern is a way of modifying complex objects without subclassing them. Instead of subclassing, you use the complex object as is and put any custom code for modifying the behavior of that object inside a separate object, which is referred to as the delegate object. At pre-defined times, the complex object then calls the methods of the delegate object to give it a chance to run its custom code.
Controls use the target-action design pattern to notify your application of user interactions. When the user interacts with a control in a predefined way (such as by tapping a button), the control sends a message (the action) to an object you specify (the target). Upon receiving the action message, the target object can then respond in an appropriate manner (such as by updating application state in response to the button push).
Managed memory model
The Objective-C language uses a reference-counted scheme for determining when to release objects from memory. When an object is first created, it is given a reference count of 1. Other objects can then use the retain, release, or autorelease methods of the object to increase and decrease that reference count appropriately. When an object’s reference count reaches 0, the Objective-C runtime calls the object’s cleanup routines and then deallocates it.

KVC (Key Value Coding)
The KVC is a concept to directly getting and setting specific properties of an object.
In  key value coding we have to pass a "Key" (any string) for getting and setting the property associated with that key.
Its not necessary to use KVC, we can also complete our project without using it. 
However, it is one of the best code patterns for reducing repetitious code and making classes more
reusable by decoupling actions from properties and data.



  1. Tremendous blog post, loads of beneficial information. I am about to show my buddies and ask them what they think.

    ipad application development

  2. It's the fantastic example of growing technology.
    Mobile App Cross Platform Development && Hire Php Developer India

  3. Thanks for offering functional data to us Regarding Android App Development, Android Course in Delhi, Android Class, iPhone Classes, iPhone Apps Development, iPhone Course and so on.Its truly accommodating for us. Much appreciated and keep continue to offering data to us.
    iPhone App Developers // Mobile Application Development // Android Application Development