I have been enjoying my dip into Flex so far. Sometimes you don't notice habits until you have to change them. One rut I've gotten into over the years is the procedural way web-based apps have gotten be thinking about programming.
The request/response nature of the HTTP protocol gets you thinking of your code as quite linear. A request for a page comes in and the code is processed as quickly as possible from top to bottom and when it is done, the result is sent back. Your code executes in little spurts all day long. Even if you are using latest and greatest "OO" practices, there is still a definite beginning and end to each request, and a given order in which it all happens.
Something I'd lost touch with since my Visual Basic days in College was the paradigm of a state-retaining app that was event-driven. Ajax interfaces have been pushing me back in that direction recently. In a Flex app there is technically an initial request and response that serves up the SWF, but once that is out of the way, you are left with a bunch of objects (some visual, some not) and defined events that are being listened for so they can respond. There is no time line per se, and the app isn't done until the user closes it or navigates away.
MXML is familiar since it is tag based. Unlike ColdFusion though, it requires the code to be XML compliant. Reminiscent of cfscript, are script tags floating around with Action Script in them. There is a lot of overlap between the AS and the MXML tags. For instance I can declare objects and variables using both. The glaring difference is what the code represents.
For lack of a better example, a lot of CFML is more of a control language. It defines processing via if statements and is tightly coupled to the output of what I am coding. CFML is always executed from the top of the page down. MXML feels more like a definition language. I am really just defining objects and their attributes as well as how they respond to events. Each tag basically represents an Action Script class.
When tags are nested, you are creating composition as the object represented by the outer tag "has an" instance of the object represented by the inner tag. Inheritance can happen when I define a component (a separate MXML file) whose file name is the name of the component and whose root tag defines the base class being extended. Properties and behaviors are overridden right there in a natural way that almost doesn't even feel overtly "OO" if you aren't paying attention.
Like ColdFusion, Flex makes the basic stuff easy. For instance, you can make a basic bar chart with normal looks and the usual expected behaviors with only a few lines of code. Flex really goes an extra level when it comes to exposing all the configurable goodness of its objects though. If I want to format a number as dollars and cents, I create an instance of the currencyFormatter class (with the like-named tag) and call its format method appropriately. I can define custom horizontal and vertical axis objects to control the display details of my graphs. There are near-endless ways the built-in Flex objects can be extended, overridden, and modified.
I like the way Flex is making me think. It feels natural and intuitive. The only thing I have done so far that felt "clunky" was the Remote Object calls to my CFCs. I hate having to have a separate function to handle the return; especially when I want it to execute synchronously. I would much rather have something like CF's cfajaxproxy where I could just call my method inline and get the results back on that same line of code. Maybe that already exists and someone can show me how.
Well, it doesn't feel like I done writing, but if I keep going I am going to start repeating myself so I'll quit. Let me know if you see Flex the same way.