2008-09-04

Flex, Cairngorm, and stupidity

WARNING: TECHNOBABBLE ALERT

So, I've been refactoring a simple Flex project that I did to use Cairngorm. "Best" practices separates the user interface from the business logic. So, I've spent an excessive amount of time over the past week trying to figure out how to communicate from one part of the program (the user interface) to the other (business logic). I finally pinned that down and can follow the event to the command (spelling is a plus here, where "Login" is different from "login" - capitalization counts). I had to talk two of our MN programmers through my project before I could explain to them what I had done wrong.

So since then, I've been trying to find a way to trigger a process in a view that reconfigures the available options from out in the command processor (business.commands.MyCommand did it's work, and now needs to start something in views.MyView). Except there was no way to call a function in "MyView" from "MyCommand" (and here's where I earned my STOOPID award for the day)... "MyCommand" has FULL access to all the variables in the Model - change a variable in the Model and the corresponding view is IMMEDIATELY (if not sooner) updated with the new value. (That's the obvious purpose of the [Bindable] metatag).

So, to execute a function in "MyView", all that needs to happen is to change the reference to the bound variable (eg. "{ __model.Value }") to a function that uses the bound value as a parameter (eg. "{ MyFunction(__model.Value) }"). When __model.Value changes, MyFunction is called to return a new value based on the new input parameter ... even if that parameter is not used in MyFunction.

So, the business logic can do what it needs to without the view needing to be cognizant of any business activities. And when the business logic changes something that is of interest to the viewer, it can update itself without disrupting any business functions.

After pouring through every example I could find for a week, I now see why I couldn't find anything about the topic - it's because the concept was too easy for anyone to document!!!

Cairngorm is growing on me. Something like mold on cheese.

Miles: Tues 11 (church, city hall to help keep someone's utilities turned on), Wed 8.5 (MIA/Bishopric): Sept to date: 19.5 mi and for what it's worth Aug=511 mi; July=618 mi; June=338; June-Aug=1467

5 comments:

Berserk said...

You know, something very similar happened to me last week. Except it wasn't in any way related to computers or technology, and it didn't include any incomprehensible phrases, and also didn't involve anything growing on me.

But other than those things, it was pretty much the same.

TheWizard said...

In other words, you also have spun your wheels, going nowhere, looking for the answer that is too obvious to see.

Frik said...

I just caught up reading everyone's blogs and I have to say that you're City Hall story was made of pure awesome. You should get some kind of award for that... Would a purple heart be too much?

TheWizard said...

I'm just fine with no fine.
I neglected to mention that I also received phone calls from 1)the traffic department (they have plans to widen the intersection with double left turn lanes), and 2)the police department - explaining why they had run the operation that they were running (he was a bit surprised to hear that the ticket had been dismissed).

Berserk said...

What reason did the PD give for that operation?