On Porting from iPhone to Netbook with Flex – Interacting with the UI: Cocoa Delegates and Flex Observers.
by Ryan Green
Today we explore the emerging zeitgeist of two companies that I love. I submit to you that embedded in the very code of their developer SDKs lie the underpinnings to a complete corporate world view. I know, profound stuff. I thought so myself while typing this in the airline terminal of Denver International Airport while waiting for a friend to arrive. Perhaps I’ve waited too long and those funnel cake sticks from that other burger chain have started to affect my brain chemistry. We shall see.
My new working theory is derived by examining the use of patterns in the User Interface components of Cocoa and Flex.
Exhibit A: Apple believes the world and developers must be controlled and well managed. This is why the primary pattern for talking to User Interface (UI) Components is the delegate pattern. The delegate pattern means that when a user does something to a component, like clicking on a Picker, that Picker UI Component delegates responsibility to a delegat-ee. In other words, the Picker tells the delegate what to do and when to do it. There are a few benefits to the use of this pattern. Delegates clean up well (memory-wise), delegates have a clear and predictable function, and there is one and only one responder for any action by a UI component.