| By Jesse Randall Warden | Article Rating: |
|
| August 1, 2006 11:45 AM EDT | Reads: |
9,752 |
It's 7:50 pm on Sunday, and I'm still working. I figured I'd share why I'm debugging like crazy instead of relaxing.
Bindings.
For those of who know of Flex 2, Adobe's tool for programmers to create Rich Internet Applications, it has this one feature that sets it apart from Flash, and incidentally, its brother Spry shares. It allows you to put a variable surrounded by curly brackets, and at runtime, anytime that variable changes, it'll update whatever variable is being set to it. So, for a TextField, you can bind a global text property to the TextField's text property, like so:
<mx:Label text="{message}" />And when you update the message variable, the Label's text property will automatically be updated. Utilizing Cairngorm, a lightweight MVC application architecture for Flex, you can take this concept a step further using ModelLocator. This is basically a global (static) class that holds global data. You can have your Views' (your visible forms) bind to these variables. Anyone who updates the ModelLocator (in this case the Model) has suddenly updated the entire app. Nice!
...that is, until something goes wrong. These bitches are hard as nuts to debug. It's even worse when you are binding to a nested property, or a set of forms and their children all bind to the same thing. Through copious refactoring, the parent view is the only one who actually binds to the ModelLocactor. The rest using public getter / setters, and use their internal private variable (Flex 1.5 only has public / private, not protected like Flex 2) for the binding. This makes it easier to debug, but not awesome. You know you're in deep shit when you're forms start getting updates, 1 frame later mind you, and have a COPY, not a reference of a ValueObject. Yes, that's right, I said a COPY, not a reference. Array's and Objects in general are always passed around in Flash by ref, so naturally I'm freaking out.
Anyway, what I have learned from this? Two things. Common literary rule is to ensure all lists have at least 3 entries, but I'm using 2 I feel they are important.
- Make the top level View use ModelLocator for binding; all children can propagate internal copies. If you have a View that uses ModelLocator, and his parent uses ModelLocator also, your code sucks, fix it. Refactor it into a binding tag, binding to a getter / setter, or a public property. You'll thank me when you go to debug and you KNOW who's setting who, and when.
- Handle null. If you're View can't handle null, it sucks. The old saying is a good acid test for your View; Garbage In, Garbage Out. If you throw a ValueObject at a form for example to edit it, and bind to the changes, fine. If it takes a null, and disables itself, fantastic. If you're View can't take a null, you know what you have to refactor.
On a lighter note, in the free milliseconds I've had in the past month to play with states & transitions in Flex has taught me another 2 things:
- States and Transitions are the bomb. It makes your View's much more flexible, allows you better control over user eye tracking (look here sucka), and good integration with event handling.
- Flex without Flash blows - Flash & Flex together can make some phat interfaces. AS3 & Component powah, Flash funk; good stuff.
I'll be showing some of the cool stuff you can do with the above August 3rd here in the ATL, August 14th in New York City, and October 23rd (ish) at MAX in Vegas. Hope to see you at one of 'em and make you go, "Awww... hell yeah!".
...and back to the mutha-fD)($Ring grind.
Published August 1, 2006 Reads 9,752
Copyright © 2006 SYS-CON Media, Inc. — All Rights Reserved.
Syndicated stories and blog feeds, all rights reserved by the author.
More Stories By Jesse Randall Warden
Jesse R. Warden, a member of the Editorial Board of Web Developer's & Designer's Journal, is a Flex, Flash and Flash Lite consultant for Universal Mind. A professional multimedia developer, he maintains a Website at jessewarden.com where he writes about technical topics that relate to Flash and Flex.
![]() |
news desk 08/01/06 12:04:13 PM EDT | |||
For those of who know of Flex 2, Adobe's tool for programmers to create Rich Internet Applications, it has this one feature that sets it apart from Flash, and incidentally, its brother Spry shares. It allows you to put a variable surrounded by curly brackets, and at runtime, anytime that variable changes, it'll update whatever variable is being set to it. |
||||
![]() |
Phil Heinz 07/31/06 08:05:03 PM EDT | |||
As a long-time Flash programmer I am always looking out for the next great tool that will take Flash to the next level. This has been true since I started many years ago with Flash 5. Every new version that came out was like a breath of fresh air - taking a design-related tool further and further into the programmer's realm. With Adobe Flex Builder 2, I am once again hyperventilating in the newly fresh air. This time, however, it's better than ever. Flash programmers now have their own tool that separates the programming from the design. |
||||
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Adobe’s Aiming ColdFusion at Multiple Clouds
- Windows 7 – Microsoft’s First Step to the Cloud
- Ulitzer Provides a Powerful Social Journalism Platform
- Jill Tummler Singer, Deputy CIO of CIA, Keynotes at GovIT Expo
- Open Source Mobile Cloud Sync and Push Email
- Practical Approaches for Optimizing Website Performance
- The Difference Between Web Hosting and Cloud Computing
- Cloud Computing on Gartner's Top 10 List and SYS-CON Events' 2010 Calendar
- Ajax in RichFaces 3.3, JSF 2 and RichFaces 4
- Confessions of a Ulitzer Addict
- IBM Hardware Chief, Intel VC Exec Arrested in Insider Trading Scam
- My Thoughts on Ulitzer
- Tactical Cloud Computing Panel at 1st Annual GovIT Expo
- US Post Office Hops a Ride on NetSuite’s Cloud
- Ulitzer.com Named Exclusive "New Media" Sponsor of Cloud Computing Conference & Expo
- WPF Controls by DevExpress
- Moving Your RIA Apps into the Cloud: Seven Challenges
- Building a Drag-and-Drop Shopping Cart with AJAX
- What Is AJAX?
- Google Maps! AJAX-Style Web Development Using ASP.NET
- Flashback to January 2006: Exclusive SYS-CON.TV Interviews on "OpenAjax Alliance" Announcement
- AJAXWorld Conference & Expo to Take Place October 2-4, 2006, at the Santa Clara Convention Center, California
- AJAX Sponsor Webcasts Are Now Available at AJAXWorld Website
- How and Why AJAX, Not Java, Became the Favored Technology for Rich Internet Applications
- "Real-World AJAX" One-Day Seminar Arrives in Silicon Valley
- AJAXWorld University Announces AJAX Developer Bootcamp
- AJAX Support In JadeLiquid WebRenderer v3.1
- Where Are RIA Technologies Headed in 2008?
- Struts Validations Framework Using AJAX






































