Aral Balkan blogged about what he called an epic FAIL of removing the Fx prefix from Gumbo. This I admit came as a bit of a surprise to me as it has been widely discussed in the community for some time and strong consensus built around using namespaces. The decision was then made by Adobe on February 13th 2009 to drop the Fx prefix and go with namespaces. For those that aren't really getting this whole controversy, its actually quite simple.

 
Initially the idea for the next release of Flex (codenamed Gumbo) was to leave out namespaces for the new components and instead use an Fx prefix. As you probably know up until now we had the mx namespace for Flex components which was like this:



  

 
The Fx prefix approach looked as follows:



  

 
The new approach with namespaces looks as follows if you want to mix and match between the old Halo and new Spark components.




  
  

OK, now I see how that can look a little more confusing -- what in fact is happening here is that you set up a language namespace (there can be only one) that defines how your MXML gets parsed and compiled.

Then for any set of components you use (as you might already be doing for third party libraries) you create a namespace. In this case one for the Halo components "mx" and one for the Spark components "s".

Why do I believe this is a good thing? Prefixing component names is not a sustainable option, in a next release you would have to go with a different prefix, i.e. Fx2Button. I don't see a huge use case of people mixing various versions of components (update: as rightly pointed out by Asger in the comments, since Form etc. are mx only at the moment you would in many cases be required to mix namespaces). This sort of reminds me of what you had happening in Flash with fscommand and fscommand2.

Namespaces are a common standard, they're implemented in the language and are good solution to avoid naming conflicts. Simplicity in syntax is one thing, I think the pragmatic approach here is seeing how things will evolve and not painting yourself in a corner.

I believe there is room for improvement but structuring MXML around namespaces makes complete sense to me at this moment in time. Moving forward there's something to be said about using naming conventions to abstract the underlying concept of namespaces. If and when the tooling (i.e. Flash Builder) is up to scratch, this whole process should be seamless for developers and not that different from how you had things in Flex 3.

 
More information here: http://opensource.adobe.com/wiki/display/flexsdk/Dropping+the+Fx+Prefix
 

Posted
AuthorPeter
CategoriesFlex