Idealism is what precedes experience; cynicism is what follows...

Saturday, June 28, 2008

"Is it Flex ?" Online Service (by James Ward)

James Ward created an online service some time ago to test if a SWF is created with the Flex compiler.
It can come on quite handy :-)

Check it out...

Friday, June 27, 2008

DFUG meeting in Aarhus - Indian Summer Knowledge

On the 23rd of July DFUG has a summer meeting...

Be there or be a { 0, 0, 50, 50 ) }...

Wednesday, June 25, 2008

Remembering the pre-AJAX days ?

Back in the early days of AJAX development, before the name was even cornered around 2004... there were many ways to obtain the AJAX-like effects of todays omnipresent XMLHTTP implementations.

One I found particularly nice was the "" HTML-component which mimicked todays Webservice-proxies.

One of the guys on my team asked me a question leading me to look it up, and to me great amusement it was still available for download right there on Microsoft's website.

Check it out in case you never had the chance to work with it, and if you have worked with it... pay it a visit and remember the "fun" times we had doing AJAX-like effects before it even had a name.

Monday, June 23, 2008

3D Charts Using PaperVision3D (by Andrew Trice)

Andrew Trice has created a simple yet very expressive example of how to use Papervision 3D to display data i multiple dimensions...

Check it out...

Saturday, June 21, 2008

Workaholics United : The Two Minute Rule

According to the Two Minute Rule, if an action takes less than two minutes, you should do it right then, even if it’s a low-priority item. Otherwise it would take more time to write it on a list and review it later. The converse of the rule is that if an action takes longer than two minutes, you should write it down to avoid getting lured into an activity whose priority hasn’t been evaluated against other tasks on your list.

That’s good advice if understood in context. When you’re batch processing an in-basket, the best way to avoid getting derailed is by adhering to the guideline that each item should take no longer than two minutes. So if you have 40 items in your intray, it should theoretically take a maximum of 80 minutes to process it to zero. In practice, it should take far less, since many items will be filed or discarded more or less instantly.

But there are times when the two-minute interval should be lenthened, shortened or dispensed with altogether. When I’m doing a weekly review, even doing two-minute actions can pull my attention away from a more appropriate project-level focus. So I write them down with checkmarks denoting them as action items to do immediately after the review.

If the action takes longer than two minutes, and you’re not in processing mode, then it might be more efficient to handle the item in the moment, especially you’re reasonably sure that it will only take a few minutes. If you’re not sure that something else might take precedence, don’t hesitate to review your calendar and action lists.

But the main point is that if there’s something that you need to get done, challenge yourself to see if there’s anything you can do this very moment to carry it forward. What can you do right now?

Synergy working with Microsoft Windows Vista

There has been a lot of discussion about getting the 2 year old release of Synergy, which at the moment is the latest release, to work on Vista OS. The very old release could be indicating that there would likely be problems getting the darn thing to work with Windows "Trouplemaker" Vista.
However, due to the low-tech techniques used by Synergy (TCP over IP) there are no problems if you run the Synergy process with local administrator privileges.

This is good news, because at current Synergy is still the only one to support all platforms (Some setup issues with Leopard which are solvable).

However, despite the latest release being from 2006, it appears that the lead-dev behind the application is planning a new release during 2008.

Check it out if you are interested in a Software based KVM switch which works with any machine supporting TCP over IP.

PureMVC : Lazily Instantiated Components

One small caveat when working with PureMVC - If your View object is defined at design time, but not created at application startup you’ll need to defer the

facade.registerMediator( )

Joshua Ostrom wrote a nice little piece about this.

Check it out...

Friday, June 20, 2008

Adobe Flex : Flex 3 Compiler Design Document

Now there is a design document available at the Adobe site... nice move :)

Adobe Flex : Custom ToolTip Implementation Sample

Every sample out there illustrating ho to use custom ToolTips involve calling a method upon registering a ToolTip event... however, that requires you to add toolTip code to every item you want to have showing a custom tooltip.

The preferred way to do it would be to set the ToolTipManager.toolTipClass property to point to your custom tooltip class.
This way an instance of your own class is created in place of the default instance of the ToolTip class.

Doing this requires you to Implement IToolTip and in order to get most of the logic done for you, its preferred that you inherit from UIComponent or one of its inheritants.

In my previous post I have pointed out that there is a bug in the Adobe Flex ToolTipManager implementation, so doing it my way requires you to override commitProperties and set the text property yourself... however, its a small price to pay for getting the power of the ToolTipManager at your disposal instead of having to implement it all by yourself.

I here illustrate a small mock implementation of an application using custom tooltips

First we create a couple of custom toolTip classes, I call the CustomToolTip1 and CustomToolTip2

import mx.containers.Panel;
import mx.controls.Label;
import mx.core.IToolTip;
import mx.managers.ToolTipManager;

public class CustomToolTip1 extends Panel implements IToolTip
private var _label:Label;

public function CustomToolTip1()

override protected function createChildren():void

_label = new Label();
addChild( _label );

override protected function commitProperties():void
text = ToolTipManager.currentTarget[ "toolTip" ];

public function get text() : String
return _label.text;
public function set text( value:String ) : void
_label.text = value;

import mx.containers.Canvas;
import mx.controls.Button;
import mx.core.IToolTip;
import mx.managers.ToolTipManager;

public class CustomToolTip2 extends Canvas implements IToolTip
private var _button:Button;

public function CustomToolTip2()

override protected function createChildren():void

_button = new Button();
addChild( _button );

override protected function commitProperties():void
text = ToolTipManager.currentTarget[ "toolTip" ];

public function get text() : String
return _button.label;
public function set text( value:String ) : void
_button.label = value;

Then finally we create an application which facilitates setting the toolTipClass of the ToolTipManager
<?xml version="1.0" encoding="utf-8"?>

<mx:Button id="button" label="Hello World" toolTip="{button.label}" />
<mx:ComboBox id="stateChanger" dataProvider="{states}" labelField="name" change="stateChanger_Change(event)" />

import mx.controls.ToolTip;
import mx.managers.ToolTipManager;

private function stateChanger_Change( event:Event ) : void
currentState = stateChanger.selectedItem[ "name" ];


<mx:State name="NORMAL">
<mx:SetProperty target="{ToolTipManager}" name="toolTipClass" value="{ToolTip}" />
<mx:State name="CUSTOM_1">
<mx:SetProperty target="{ToolTipManager}" name="toolTipClass" value="{CustomToolTip1}" />
<mx:State name="CUSTOM_2">
<mx:SetProperty target="{ToolTipManager}" name="toolTipClass" value="{CustomToolTip2}" />


Adobe Flex : There is a bug in the Adobe Flex Framework ToolTipManager Implementation

I have registered it with the Adobe Flex Team.

When using a CustomToolTip set via the ToolTipmanager.toolTipClass property, "text" is never invoked.
Its easily solved however, it just requires you to override commitProperties and set the text yourself.

  override protected function commitProperties():void
text = ToolTipManager.currentTarget[ "toolTip" ];

And here is a complete implementation of a custom tooltip.

import mx.containers.Canvas;
import mx.controls.Button;
import mx.core.IToolTip;
import mx.managers.ToolTipManager;

public class CustomToolTip extends Canvas implements IToolTip
private var _button:Button;

public function CustomToolTip()

override protected function createChildren():void
_button = new Button();
addChild( _button );

override protected function commitProperties():void
text = ToolTipManager.currentTarget[ "toolTip" ];

public function get text() : String
return _button.label;
public function set text( value:String ) : void
_button.label = value;

I suppose you can also workaround it by changing the ToolTipManagerImpl class, but I prefer not to change the framework sourcecode for so many reasons that its beyond the scope of this post.

Also, I really dislike every sample out there illustrating how to implement custom tooltips, as they all involve calling a method on a toolTip event and hence requires you to use your custom ToolTip logic everywhere in your system instead of using the framework.

Wednesday, June 18, 2008

Adobe Flex Resources Tool Suite

I plan to implement a small set of tools to facilitate handling of resource files in Adobe Flex.

I will address the following objectives:

1. objective
It must allow editorial staff to update and manage resources.
* Client should be implemented in AIR / Flex.
* Server should be implemented in .NET

2. objective
It must allow editorial staff to compile resources to their final output.
* Should use the Flex SDK compilers based on Java.

3. objective
It must allow editorial staff to deploy updated resources.
* Should be possible to do 24/7 without causing downtime.

4. objective
It could facilitate that editorial and technical staff can work in parallel, respectively translating and updating resources to their initial values by the editorial staff and creating the points in the application where each resource will be used by the technical staff.
* Points still needs to be determined.

HelloGroup is proud to announce their new website !?

HelloGroup has today launched their new long awaited new website !

The site proves to show that we are so busy servicing our esteemed clients and building some of the best and innovative websites for them, that we don't have time to create our own website.

Anyways, there is really not that much more I can say about that.
...except that the videos are fun to watch for us the employees seeing that we are in them.

However, I'm not sure who to compare us with based on the web-experience we give our customers, potential customers and the occasional spurious visitor... not to mention potential employees who, if they are any good, would want to work for the best of breed among media-houses in Scandinavia.

Why based on Wordpress, why that boring graphical design, why all the strange colors and quite poor lighting on the videos, why videos hosted at youtube, why the outdated functionality, why the many violations of every gestalt rule in the book... why ohhh why...

Xoopit turns your Gmail into a multimedia heaven

Firefox extension Xoopit turns Gmail into a robust, searchable media management tool for every piece of media that comes through your inbox. By indexing every attachment as well as every link to photos and videos from sites like Flickr, Picasa and YouTube, Xoopit allows you to easily search for and find any picture or video and view it from directly inside Gmail.

Imagine this: You're looking for a YouTube video that you were sent a link to recently, but you really don't know where to begin your search. With Xoopit installed, you can just click the Videos tab and you'll see this:

Check it out...

Google Social Graph API

The public web is made up of linked pages that represent both documents and people.

Google Search helps make this information more accessible and useful. If you take away the documents, you're left with the connections between people.

Information about the public connections between people is really useful -- as a user, you might want to see who else you're connected to, and as a developer of social applications, you can provide better features for your users if you know who their public friends are.

For long there hasn't been a good way to access this information, however now The Social Graph API makes information about the public connections between people on the Web, expressed by XFN and FOAF markup and other publicly declared connections, easily available and useful for developers.

How does the Social Graph API find these connections ?
The Social Graph API looks for two types of publicly declared connections:

1. It looks for all public URLs that belong to you and are interconnected. This could be your blog (a1), your LiveJournal page (a2), and your Twitter account (a3).
2. It looks for publicly declared connections between people. For example, a1 may link to b's blog while a1 and c link to each other.

dotNet : Other New Technologies

There were two CTP releases recently of technology that don't directly focus on web services but you might find that they make developing services easier.

The first technology is called Velocity. Velocity is a platform for building distributed caches to make it easier to develop highly-scalable applications. There are some included samples for using Velocity with ASP.NET applications but you can reuse the platform in a variety of ways.

Microsoft Project Code Named "Velocity" Community Technology Preview 1 (CTP1)

The second technology is called Task Parallel Library and PLINQ. There are a set of parallel extensions for writing query and iteration expressions that automatically take advantage of the data and task parallelism present in high-level programming constructs.

Microsoft Parallel Extensions to .NET Framework 3.5, June 2008 Community Technology Preview

You can get several videos about these parallel extensions on Channel 9 as well.
* Joe Duffy and Igor Ostrovsky: Parallel LINQ under the hood
* Joe Duffy, Huseyin Yildiz, Daan Leijen, Stephen Toub - Parallel Extensions: Inside the Task Parallel
* Inside Parallel Extensions for .NET 2008 CTP Part 1
* Inside Parallel Extensions for .NET 2008 CTP Part 2

Tuesday, June 17, 2008

StateMachines : Implementation of WF in AS3

I have now successfully ported a minimal subset of the Windows Workflow Foundation to AS3. Initially I have created Sequential and StateMachine Workflows with just a set of non-nestable Activities.

Next point of focus is on implementing a set of sample applications which will illustrate the power of having an event-driven application based on StateMachines as well as a number of Applications illustrating how easy keeping a complex set of activities in strictly sequence using the SequentialWorkflow.

Another important aspect right now is to get the WorkflowRuntime just right as it right now pretty much only works as a Workflow factory.

MyHome Benchmarks with YSlow

YSlow analyzes web pages and tells you why they're slow based on the rules for high performance web sites. YSlow is a Firefox add-on integrated with the Firebug web development tool and as such is very easy to handle.

I have created a small benchmark test with MyHome against HelloGroup's and Elsparefonden's public websites.

Obviously we still have some optimization to do, but its also obvious that we are not that far from reaching an acceptable minimum for the initial load sequence.

Checkout YSlow here...

Configuring Flex Builder to use the HellFire compiler

Clement Wong has created an excellent post on how to do RPC compilation of Flex Applications, Modules and Libraries.

The results he has been able to obtain are very thought-invoking and definitely something I will give a shot the first time I get 5 minutes to spare...

Check it out for yourself...

AIR 1.1 : Now with Localization !

For us Danish developers, localization is always a major concern... so the fact that Adobe AIR 1.1 is out now with support for localization just made the platform more interesting...

Adobe AIR 1.1 is a small release that adds international support to AIR applications. In the future, the Flex team will release official updates to both the Flex SDK and Flex Builder that include the latest version of AIR. However, this particular release is happening off of the Flex release cycle so there some inconveniences involved when installing it.

You can read more about it here in Matt Chotin's short article clearing this up...

And you can download it here...

Google Browser Sync Discontinued in FF 3

If you are as sad as I am that Google have decided to discontinue further development of the Google Browser Sync, please dont hesitate to sign the petition...

You can read about Google's decision here...

And sign here...

Monday, June 16, 2008


Adobe has recently launched !
Uncertain what the fucture may bring, its quite interesting to see whats gonna happen with this initiative...

Check it out...

Sunday, June 15, 2008

Adobe Flex : Cross-versioning

The "Marshall Plan" is the nickname for the SDK feature to support cross-versioning.

The nickname comes from the aspect of the feature that uses shared events and/or the SandboxBridge to marshal objects across ApplicationDomains. Marshalling was popularized in Windows as a way of transcoding objects so they can be shared between applications in different address spaces.

If the vision comes true, the "Marshall Plan" will define a post-3.1 Flex that liberate developers from having to have all of their code compiled by the same version of Flex.

Read more about this initiative which are planned to be part of the Flex 4 release.

The benefits of Functional Design

In continuation of my latest post regarding easily maintainable systems, I will start by writing about the benefits of Functional Design.

A functional design assures that each modular part of a computer program has only one responsibility and performs that responsibility with the minimum of side effects on other parts. Functionally-designed modules tend to have low coupling as concrete side-effect and more importantly, they scale much better than other types of designs.

The advantage for implementation is that if a software module has a single purpose, it will be simpler, and therefore easier and less expensive, to design and implement.
Systems with functionally-designed parts are easier to modify because each part does only what it claims to do.

Since maintenance is more than 3/4 of a successful system's life, this feature is a crucial advantage. It also makes the system easier to understand and document, which simplifies training. The result is that the practical lifetime of a functional system is longer.

In a system of programs, a functional module will be easier to reuse because it is less likely to have side effects that appear in other parts of the system.

The Standard way to assure functional design is to review the description of a module. If the description includes conjunctions such as "and" or "or", then the design has more than one responsibility, and is therefore likely to have side effects. The responsibilities need to be divided into several modules in order to achieve a functional design.

To perform Functional Design is quite easy, you can start by defining packages/namespaces based on Use Cases as can be illustrated by the following package definition:


The package above would then contain all the classes which makes up the concrete use case implementation. In the case of a Flex application it would contain at least the Command and Event, but depending of the lines drawn in architecture - possibly the forms and UI objects as well.

This should be seen in contrast to having the Command in a namespace called Commands and the Event in a namespace called Events.

Functional Design has one limitation, and that is that you need an underlying set of baseclasses which implement all your Boilerplate code and thus faciliate that your concrete namespaces dont need to be to highly coupled to other parts of the system on the same level.

Maintenance is more than 3/4 of a successful system's life

A frequent question is why we as developers prefer to make quality code and why we hate to hack together a system in order to meet a business objective, typically a unreasonable deadline or an unreasonable amount of time allocated to a project.

The answers is pretty simple, us developers spend apr. 3/4 of our working life maintaining systems - not defining them.
This is the reason why quality in application design becomes desirable at the cost of immediate productivity.

I will address this issue in a series of blogposts where I try to define what I consider to be the constitution of a well implemented system design and what defines an easily mantainable system...

Low Coupling

If I should choose only one thing from the knowledge I gained from my software engineering classes at university, I would have to go with "Low Coupling / High Cohesion"...

However, it appears that not all have been introduced to universal truth of the objective regarding implementing this in system design and architecture.

Coupling can be "low" (also "loose" and "weak") or "high" (also "tight" and "strong"). Low coupling refers to a relationship in which one module interacts with another module through a stable interface and does not need to be concerned with the other module's internal implementation. With low coupling, a change in one module will not require a change in the implementation of another module. Low coupling is often a sign of a well-structured computer system, and when combined with high cohesion, supports the general goals of high readability and maintainability.

Systems that do not exhibit low coupling might experience the following developmental difficulties:

* Change in one module forces a ripple of changes in other modules.
* Modules are difficult to understand in isolation.
* Modules are difficult to reuse or test because dependent modules must be included.

The concept of coupling is usually related to the concept of cohesion: low coupling facilitates high cohesion, and vice versa. For example, one approach to increasing cohesion is functional design, which seeks to limit the responsibilities of modules along functionally-related boundaries. Modules with single responsibilities tend to communicate less with other modules, which typically causes the side-effect of reduced coupling.

Low coupling may also reduce performance, and a highly-coupled system is sometimes desirable to achieve maximum efficiency. Regardless, in many modern computing systems, the cost of reduced performance is often seen as a worthy trade for the benefits to the software development process that result from low coupling.

If you have no idea what I am talking about or would like to read more about how to obtain this in Flex, there is a pretty good article @ that describes it pretty well and in great detail...

Check it out...

Mock Frameworks, not for everyone and everytime

A frequent question is when should I use a mock object framework ?
However, if you have to ask "when", the answer is probably "not now". I feel that mock object frameworks are something you have to evolve into.

First, we can talk about mocks in general. Some people have a misconception that mock objects are only useful if you need to simulate interaction with a resource that is difficult to use in unit tests - like an object that communicates with an SMTP server. This isn't true.

* The real object has nondeterministic behavior
* The real object is difficult to setup
* The real object has behavior that is hard to trigger
* The real object is slow
* The real object is a user interface
* The real object uses a call back
* The real object does not yet exist

If we were to step back and generalize this list, we'd say test doubles are useful when you want to isolate code under test. Isolation is good. Let's say we are writing tests for a business component. We wouldn't want the tests to fail when someone checked in bad code for an auditing service the business component uses. We only want the test to fail when something is wrong with the business component itself. Providing a mock auditing service allows us to isolate the business component and control any stimuli the component may pick up from its auditing service. When you start feeling the pain of writing numerous test doubles by hand, you'll know you need a mock object framework.

Mocks aren't just about isolation, however. Mocks can play an important role at any time if employed correctly. Mocks can be powerful technique for identifying types in a system based on the roles that objects play … In particular, we now understand that the most important benefit of Mock Objects is what we originally called interface discovery.

Using a mock object framework allows a continuous, top-down design of software. But Aren't Mock Object Frameworks Complex?

This is another question I've been asked recently. Mock object frameworks are actually rather simple and expose a small API. There is complexity, though, just not in the framework itself. As I said earlier, I think there is a path you can follow where you evolve into using mock object frameworks. The typical project team using a mock object framework is experienced with inversion of control containers. Trying to get up to speed on all these topics at once can be overwhelming.

There is also some complexity in using mocks effectively. In Mocks and the Dangers of Overspecified Software, Ian Cooper says:

"When you change the implementation of a method late in the implementation process, mocks can break because you now make additional or different calls to the dependent component that is being mocked. … The mocks began to make our software more resistant to change, more sluggish, and this increased the cost to refactoring. As change becomes more expensive, we risked becoming resistant to making it, and we risk starting to build technical debt. A couple of times the tests broke, as developers changed the domain, or changed how we were doing persistence, without changing the test first, because they were frustrated at how it slowed their development. The mocks became an impedance to progress."

Mock object frameworks make interaction based testing easy, but can also lead to the problems Ian outlines. Here a couple more reads on this topic:

* Guidelines to Using Interaction Based Testing
* Why Mock Frameworks Suck

In summary – mock object frameworks aren't for everyone. You'll know when you need one!

Adobe Flex : Linkreports

An important tool when trying to examine an application with the objective to divide it into modules and libraries or generally if you want to understand your application better, is the linkreport compiler option.

Adding the following to your compiler options will print a linkreport upon a successful compile. A linkreport is an XML file which lists all type definitions included in the output as well as the classes it depends on, but has not included.

eg. -linkreport=../reports/Linkreport.xml

It will generate the file on disk relative to the BIN directory, so if you want to place the linkreport in a separate directory on level with the BIN directory you have to append ../ to the beginning of the value.

Silverlight Tour Workshop

If you are keen on getting up to speed with Silverlight 2, there is a chance with the Silverlight Tour Workshop orchestrated by Wildermuth Consulting Services.

The Silverlight Tour Workshop is a three-day course on Silverlight 2. It divides the content into three distinct areas: Design, Development and the Server-Side. Students should be able to develop Silverlight 2 applications once attending the workshop. The Workshop is structured with a mix of didactic lessons, demonstrations and hands-on labs. Each student will leave the workshop having created several small Silverlight 2 applications. This variety of learning techniques will ensure that all students become proficient in the technology quickly and in an exciting way.

Silverlight is about building Internet applications so experience building web applications is encouraged. In addition, since Silverlight utilizes .NET to build online experiences, familiarity with .NET is suggested. No specific experience with WPF or XAML is necessary.

The schedule is as follows...

* June 16-18, 2008 Washington, DC
* June 23-25, 2008 Toronto, ON
* July 14-16, 2008 Chicago, IL
* August 6-8, 2008 Melbourne, Australia
* August 11-13, 2008 Boston, MA
* August 27-29, 2008 Toronto, ON
* September 1-3, 2008 Denver, CO
* September 22-24, 2008 New York, NY
* September 24-26, 2008 Toronto, ON
* October 22-24, 2008 Atlanta, GA
* October 29-31, 2008 Sydney, Australia
* November 3-5, 2008 San Diego, CA
* November 19-21, 2008 Seattle, WA
* December 1-3, 2008 Dallas, TX

Check it out...

Saturday, June 14, 2008

Flex AIR and ActionScript Posters

If you have a registered edition of Flex Builder and a valid license key, you can order your Adobe Flex / AIR posters.

Read more here

Adobe Flex : Flex community-powered Search

The community powered search is designed to help people find the best answer to their question within the Adobe Flex eco-system, no matter where the answer may reside. If the best answer is on someone’s blog in the community, that’s the answer we want to help people find. Itøs not intended to replace the existing search on, but will be available as a new beta search. There will be a team of Flex advisors who are adding URLs/domains to this search on an ongoing basis.

To find this feature:
Navigate to and look in the right-nav in the Flex DC, there you should be able to see the “Search Community-Powered Help” form field.

Be your own toolsmith and instrument your applications

Any craftsman is only as good as his or hers tools allow him to be. I am not saying that a poor craftsman will become great with good tools, but a great craftsman will become poor if the tools does not match the skillset of the craftsman.
Historically I have always been a relentless early adopter in regards to programming languages and platforms, I have therefore often lacked proper toolsupport in order for me to accomplish working with the new technology and still remaining highly productive. It has thus become as a second nature for me to instrument the systems I work on with build-in highlevel tools to aid development.

I never thought about this consciously until I read Dave Colletas article about some tools they have build into Buzzword in order to debug the application.
His article made me think that its perhaps not as widely an adopted technique than I was walking around thinking.

Check it out...

HTML Code Formatter

Mike Chambers have created a simple, yet extremely cool app.
It's a service which formats code into HTML on Google Add Engine.

Excellent... :)

Check it out...

MSDN : TechEd 2008 in Barcelona

Now registration is opened for this years Microsoft TechEd in Europe.

If you sign up prior to the 31st of July, its possible to get a discount on the fee.
This year there is gonna be a lot about Silverlight, so be sure to sign up if you are working on RIA's.

There is a discount code which will make it possible to get some discount:

Check it out...

Adobe Flex : Coding Standards

In this months edition of the Adobe Edge newsletter, there is a an excellent article about coding standards in the Adobe eco-system.

Check it out...

Adobe Flex : Remember that the MXML inherits from the base logic class.

What this means is that as you add children components to the MXML and you want the ActionScript Logic to manipulate them you have to make sure the ActionScript has them declared. To declare them you have to define properties in the ActionScript class whose name matches the component id you use in the MXML. For example, look at the Button id in the MXML above and notice that I have a public property in the ActionScript with the same name. The property must be public in the ActionScript class and you should mark them as [Bindable] so that if you have other components binding to them the change watcher system still operates as expected.

This works because the MXML file is an extension of the base logic class and the components with the matching id is equivalent to overriding the properties in the ActionScript. You may wonder why the properties have to be public and not protected if this is an override. The issue is that the MXML components are not part of the MXML class, they are children of the MXML class. Since they are children they do not have access to the ActionScript class’ protected methods and the compiler will see their id as a duplicate name for the MXML class, which is invalid. If the method is public, the compiler interprets this MXML component id as an override and it works. So, long story short… always make the properties [Bindable] public.

Adobe Flex : Never try to manipulate the children components from the ActionScript constructor

This is a common mistake made by developers using this pattern. For example, you try to set the button label in the constructor. If you tried this you would get a null value error for the button since it has not been created yet. MXML creates the children components in the initialize() phase so the best way to work around this is to override initialize(), call super.initialize() first and then you can start accessing children components.

Adobe Flex : Coding Conventions

The Adobe Flex Team has taken the initiative to create a Coding Convention for Flex solutions.
Its not yet complete, and some places they still have some TBD's... however, the stuff thats already available should be read and understood by every Flex developer.

We are not following all of them rigidly on my team, however.. we will use the Coding Convention from Adobe to assess the places where we defer and check their validity in contrast to the Adobe Coding Convention.

Check it out...

Adobe Flex : Never try to removeChildren() that are defined in MXML

This is a mistake that sometimes works when you try it but in most cases this just causes a lot of heartache. Usually the heartache occurs after you have been doing this for a while and you then have to go back and fix a lot of code that was dependent on the first removeChild(). Unfortunately I have seen this first hand and its not a pretty sight. If you are doing a lot of children manipulation then you will want to move away from MXML declaration and handle the children creation/removal all in ActionScript.

Adobe Flex : Event/Action binding in MXML and AS

Try to avoid mixing and matching MXML and ActionScript event/action binding. This is also more of a recommendation then a requirement. If you start binding the creationComplete or click events in MXML try to bind them all in MXML. If you bind your events in ActionScript try to bind all of them in ActionScript. Once you start mixing and matching it can be hard to track down code flow later on. You may find yourself wondering why an event keeps triggering because you left it in MXML and forgot about it. In my above example I bind the click event. You can easily do this in the initilize() method using addEventListener(). Use what works best for you.

Adobe Flex : The Code-Behind Pattern

The Flex code-behind pattern is a design pattern that is not known or used by a lot of developers. The initial concept of the pattern was based on the ASP.NET development pattern where the layout is handled in a main file and a secondary “backing” file handles all the logic. The goal of the pattern is to create a clear separation of logic and layout.

When you first learn Flex there is often confusion between what MXML is and how it relates to ActionScript. We tend to think of it as different entities, but the reality is MXML is just an abstracted form of ActionScript. MXML is a declarative XML syntax that is converted by the compiler into an ActionScript class. This is an important concept to understand because this is the root of why the compiler throws an error when trying to have a MXML file and an ActionScript File with the same name in the same package. The MXML file is really just an ActionScript class and therefore we have a conflicting namespace error.

To help visualize this, imagine the root node of the MXML file is the same as an extends statement.

When we use something like this in MyApp.mxml:

<mx:Application xmlns:mx="">

We are really saying:
public class MyApp extends Application

So why do we need an MXML syntax if it just becomes ActionScript. As you are probably well aware, doing complex layout in ActionScript takes a ton of code, especially when you get into the world of nested layout. It can be done in code but why would you want to? XML is all about parent/child hierarchies and by using this as a layout language you can quickly define complex organizational structures that would have taken hundreds of lines of code if you did it all in ActionScript. Now that we have a better understanding of the MXML/ActionScript relationship we can start talking about how the pattern is implemented.

When looking at Adobe’s MXML examples we often see them using the tag to define any ActionScript that is required to make the MXML example work. This approach is fine for simple examples but once we begin development of a larger application using Flex, having all the MXML logic in a single tag becomes unwieldy. Even if the code is written by the most organized developer, once you hit 300+ lines of ActionScript with 100 lines of MXML it becomes hard to see the forest from the trees.

One way to solve this is to use the source attribute in the tag and set it to an external AS file. This helps because you now have separated all your ActionScript out of the MXML but now you have externalized AS files that aren’t really classes, that sit in the file structure and you can’t extend from them.

The Code-Behind pattern is a solution to this issue. The first step is to create an ActionScript class that extends the base type that you want your MXML file to be. For example, a Canvas:
package com.hello.demo
import mx.containers.Canvas;

public class MyComponentLogic extends Canvas


I have now created a Class in the com.hello.demo package that extends from Canvas. This is my backing logic class that my MXML extends from. Note that I have used the postfix “Logic” to create a unique name. If you recall, our MXML and AS have to be different names. I prefer the “Logic” postfix but you can use “Base” or “Backing” or any other postfix/prefix you like. Now, you can create the MXML file. In this example let’s assume the MXML component is in the same package as the ActionScript:

This code would be in an MXML file called MyComponent.mxml. The MXML now extends from the ActionScript and we can begin to start laying out content and adding logic as needed.

Some alternatives to the technique I describe here, is to use the Supervising Controller pattern or the ViewHelper. However, a sidenote to the Supervising Controller is that you should probably choose to call the classes for ...Presenter instead if ...Controller as the use of Controller seems to put some people of if they are not familiar with this pattern and leading them to think they are FlowControllers or ApplicationControllers. Read more about the Supervising Controller pattern at Martin Fowler's excellent website...

Adobe MAX 2008

Milano is one of the most beautyful cities in the world, and this December its gonna be the venue for this years Adobe MAX conference.

If you have not already checked it out, be sure to visit the website to see the latest updates about it...

ItDepends : A tool for visually exploring the dependencies between classes and packages in an Adobe Flex application

Currently I am converting an existing application with about 3.500+ classes to use RSL's. It's proven to be rather difficult because we are using a lot of different libraries and modules with quite a number of dependencies between libraries. Despite no libraries having direct circular dependency, there are some indirect dependency-circles in the system.

When moving to a RSL-based architecture it becomes extremely important to understand the class-definitions included in each library and modules.. and more importantly to know exactly when they are both loaded, needed and used.

ItDepends is a tool for visually exploring the dependencies between classes and packages in an Adobe Flex application.
It's a great aid when undertaking my task, but even during the normal development of modular applications it can be valuable to use it when considering how to break up the application to increase performance as well as general system quality.

Check it out...

FlexCover : A code coverage tool for Flex, AIR and AS3

Flexcover is a code coverage tool for Flex, AIR and AS3. It incorporates a modified version of the AS3 compiler which inserts extra function calls in the code within the SWF or SWC output file. At runtime, these function calls send information on the application's code coverage to a separate tool; The modified compiler also emits a separate "coverage metadata" file that describes all the possible packages, classes, functions, code blocks and lines in the code, as well as the names of the associated source code files.

Check it out...

Adobe Flex 4

Flex 4, codenamed Gumbo, is now beginning development.
Some themes are being considered, such as...

* Design in Mind: provide a framework meant for continuous collaboration between designer and developer. Probably involves an additional component model that integrates with the existing Halo components.
* Accelerated Development: take application development from concept to reality quickly. Features could include application templates, architectural framework integration, binding improvements.
* Horizontal Platform Improvements: features that benefit all application and user types. Features could include compiler performance, language enhancements, BiDi components, enhanced text.
* Broadening Horizons: expand the range of applications and use-cases that can leverage Flex. Features could include finding a way to make the framework lighter, supporting more deployment runtimes, runtime MXML.

When the first Beta 1 of the Adobe Flex 4 is going to be rolled out later this year, I plan to do some some workshops on my team where we take all the new features and address them methodically one by one. It has proven to be a very effective method to acquire knowledge about a framework to use a top-down approach resembling brute-force attacking from A to Z.

If you are interested in learning more about the Adobe Flex 4 project, check it out here...

Thunderbolt : A logger extension for ActionScript 2 and 3

ThunderBolt is a logger extension for ActionScript 2 and 3 as well as Flex 2 and 3 applications based on the Firebug add-on for Firefox.

It looks very promising, and knowing Jens Krause's ordinary high level of ingenuity and as well as quality, I am willing to give it a shot.


* Detailed information (class, file, line number, time, frame)
* Log levels (info, warning, error, fatal)
* Interactive tree view for complex object structures
* Profiling (time spend during code execution)
* Collapsible grouped output
* Filter log by classes and packages
* Interactive console (inspect and modify object on runtime)
* Tree view for complex object structures such as class identifier and its properties
* Custom LogTarget based on Flex Logging API including filters
* memory snapshot
* stop logging flag
* SWC components for logging using Flex 2/3 or Flash CS3

Friday, June 13, 2008

SVN : Frequency of Update&Commit cycles

Its very disputed indeed, however I have experienced that some practices in using SVN results in less conflicts than others.
The practices which yield the best results depend highly on the method in the organization and the general practices of the team.
Every opinion I share in this post is therefore based on the notion that it works in the company I work for and the current team I am working in as well as the codebase we are working on.

During a development cycle I will probably end up updating every hour or so. This is not a conscious activity, but more of a habit as it has proven to allow me to experience long periods of no conflicts or merges.
I should perhaps point out that I work as an architect on a system with about 10 developers and a codebase of apr. 3500 classes divided into vast amounts of modules and libraries. Our SVN is configured with positive assertiveness so we let the SVN assume that conflicts will not appear and that if they do, merges will be possible. This works well for us.

The single most important rule of SVN engagement on my slate is the "Update Prior Commit" dictating that I always run an update before I execute a commit. SVN will warn you anyways, but it gives me a second to think about what I am committing which I have think gives me some percentages in regards to preventing SVN errors.

I would say that anyone in our organization should commit at least every day and should update at least a couple of times per day. This is due to the very lively nature of our current codebase which kinda means that we don't have any very stable areas in the codebase except for our core classes.

If the task at hand is too big to be committed every day, it should be branched and hence committed every day. This practice has a couple of times proven to work as an invaluable backup when disks have malfunctioned or users have caused Error-40's (In case you don't know I what I am referring to with "Error-40", ask a computer-saavy Dane - (s)he will tell you :-) )

(to be continued)

Wednesday, June 11, 2008

HCI : Morphable Interfaces - The Initial Inspiration

The initial idea of addressing many of the presentation issues concerning RIA user interfaces by the term "Morphable Interfaces" came in relation to the by now quite old video on YouTube illustrating some of Nokia's visions for the future nano-technology based concept for cell-phones.

In case you have been living under a rock in regards to web-hypes the last year, I bring you the link for the video... Its still a cool video, even though I have already seen it a couple of times by now...

Nokia's Morphable Concept

PureMVC & Cairngorm : Introducing Tech Per

Tech Per had visited my blog yesterday, just to find a spurious blog entry of unknown origin on which he diligently commented and asked if "I was serious", however using different wording.
Nevertheless, I promptly deleted the post and went to Mr. Per Tech's website to find a way to offer an explanation as he was absolutely right, I was not serious and I still have no idea how the entry had arrived on my blog (I stand to blame an empty bottle of cognac, but I still don't have concrete evidence - only circumstantial).

Nevertheless, and all other things being equal...
Per Tech has an interesting blog and I suggest all to pay it a visit.
One post on his blog, to which I have dedicated this entry, is about PureMVC and Cairngorm. The post is just some arbitrary thoughts from Per Tech on the topic, and its quite liberating to read some simple thoughts... and not read something which the author had probably envisioned as being the final breakdown of differences offering complete closure to all disputes and provide objective and unbiased precedence for years to come... These are just ideas, and as such needs no more introduction...

Check it out...

Sunday, June 08, 2008

State Machines : The C in PureMVC

I have some difficulty figurering out how to combine the notion of a statemachine workflow with the PureMVC notion of commands as the primary work-units. Using states seems to defy the need for commands and if not in direct conflict only because one could imagine using the statechange events to trigger commands. However, the ladder seems to create additional complexity in return of no other benefit than being able to use a statemachine workflow as the primary driver in a strict PureMVC system without removing logic from the commands.

Cliff Hall started a working group with this focus, but it appears that they too have had some difficulty cornering the right way to combine this.

Check it out...

State Machines : Windows Workflow Foundation

Windows Workflow Foundation has buildin support for building state-machine workflows to be used from any dotNet based host.

I will explore this in the upcoming weeks in relation to my effort to contribute to the further development of State Machine support in the PureMVC framework.

Check it out...

State Machines : Basic Thoughts

There is one important decision to make when creating a new workflow. Will the workflow be a sequential workflow, or a state machine workflow? Windows Workflow provides these two types out of the box. To answer the question, we have to decide whois in control.

A sequential workflow is a predictable workflow. The execution path might branch, or loop, or wait for an outside event to occur, but in the end, the sequential workflow will use the activities, conditions, and rules we've provided to march inevitably forward. The workflow is in control of the process.

A state-machine workflow is an event driven workflow. That is, the state machine workflow relies on external events to drive the workflow to completion. We define the legal states of the workflow, and the legal transitions between those states. The workflow is always in one of the states, and has to wait for an event to arrive before transitioning to a new state. Generally, the important decisions happen outside of the workflow. The state machine defines a structure to follow, but control belongs to the outside world.

We use a sequential workflow when we can encode most of the decision-making inside the workflow itself. We use a state machine workflow when the decision-making happens outside the workflow.

State Machines : A Powerfull Programming Tool

State machines have always fascinated me. There is a clockwork precision to their inner workings that appeals to me on an aesthetic level. They are also an invaluable programming tool. In building libraries and applications, I have returned to them again and again.

A state machine is a model of how something behaves in response to events. It models behavior by making its responses appropriate to the state that it is currently in. How a state machine responds to an event is called a transition. A transition describes what happens when a state machine receives an event based on its current state. Usually, but not always, the way a state machine responds to an event is to take some sort of action and change its state. A state machine will sometimes test a condition to make sure it is true before performing a transition. This is called a guard.

* A state machine is a model of behavior composed of states, events, guards, actions, and transitions.
* A state is a unique condition in which a state machine can exist during its lifetime.
* An event is something that happens to a state machine.
* A transition describes how a state machine behaves in response to an event based on its current state.
* A guard is a condition that must be true before a state machine will perform a transition.
* An action is what a state machine performs during a transition.

This description of state machines introduces several abstract concepts quickly, and is not meant to be formal or complete. It is just a starting point. I will explore what state machines are in a series of posts.

Next post will be about the implementation of State Machines in Adobe Flex with a running code example.

Tuesday, June 03, 2008

Adobe OnAIR Tour Stockholm (2)

Jens Brynildsen have been so nice to share his photos from the Adobe OnAIR Tour's stop in the swedish capital, Stockholm.

Check it out...

Adobe OnAIR Tour Stockholm (1)

A day inside the "Munchen-bryggeriet" masshall when the weather was so good and Stocktown was at its finest, caused everyone to assume that the sessions would be as abandoned as the beach in Jaws succeeding the second attack of the killer-shark... however, it was not !
It was packed with designers, flash programmers and flex developers (and perhaps even an existing AIR developer) and off course reps. from Adobe.

The food was great, the "swag" was OK and enough so that everyone seemed to feel appreciated.
Lots of cool people with lots of great knowledge and ideas...

Stay posted for more on this topic...

PureMVC : Pipes : Demo

Mr. Cliff Hall has been dug down for about a week to produce a long anticipated demo for the Pipes part of the framework.
Pipes are so cool, I can not imagine larger systems not using them...

Check it out...

Blog Archive

My Network