Thursday
Dec112008
Design Patterns in iPhone Development
UIKit framework (the framework used in iPhone development, as opposed to AppKit, the framework used for Mac OSX development) incorporates a few design patterns that most Flash developers should be familiar with.
- MVC - Model View Controller design pattern is a way of separating concerns and responsibilities into independent functional areas. Most Flash developers should be very familiar with this, in fact, the popular frameworks such as PureMVC and Cairngorm utilize this pattern within the framework.
- Delegation - Most Flash developers should be familiar with the concept of a delegate from an implementation standpoint. From a design standpoint, delegation design pattern allows you to modify an object's behavior without you having to subclass them. Take array sort in Actionscript for example. The sort takes a custom compare function provided by the client code. That's delegation in action and it allows you to modify the sort behavior without resorting to subclassing the Array class.
- Target-Action - UI controls use target-action design pattern to communicate UI events with the controller object. Flash developers should be no stranger to this pattern - this is essentially an event dispatch pattern, wherein target is the listener object, and action is the event handler.
- Managed memory Model (reference counting scheme) - The last design pattern is not used by Actionscript, or rather, it's only used internally by Actionscript VM and not something a Flash developer needs to worry about. iPhone does not support garbage collection (Cocoa only begins supporting GC starting OS X 10.5). As an iPhone developer, you wll use you would use the retain, release, or autorelease methods of an object to manage its lifecycle.
tagged
design patterns in
Development,
iPhone
design patterns in
Development,
iPhone 

