Skip to main content
matt_chotin
Inspiring
February 6, 2009
Question

Fx prefix revisited

  • February 6, 2009
  • 72 replies
  • 23035 views
Alrighty, we promised we'd have further discussion about this on the forums, so here we go. Since I think the email system can't handle really long posts, I'm going to post a series of things that I've written up, along with some responses that started among the team. We'll take things from there.

Solving the naming convention with regard to overlapping classnames is especially difficult when you take a number of factors into account. Here are some of the things to consider as we look to address the issue (not prioritized and not exhaustive):

These issues can be attributed to general use and the SDK:
- Flex 4 aims to be compile-time compatible with Flex 3. This means that we cannot rename existing classes nor break major interface contracts.
- Given we can't rename existing classes, what package naming structure makes sense if new classes will overlap with existing.
- How does CSS differentiate between classes with the same local name (class name)
- How will new users understand the differences between Spark and Halo classes, and especially understand when there is overlap
- What should documentation do to differentiate between Spark and Halo controls, and how do we control which page a user arrives at when searching
- How will someone reading code easily understand which control the code is using
- Given the change in architectures, how does someone easily know which architecture a component belongs to
- The number of overlapping controls between Spark and Halo will increase after Flex 4, Spark will receive new controls over time

These issues can be attributed to an IDE (any of 'em):
- How does code hinting work when you have overlapping classes (what can it do to help differentiate)
- If a list of components is in a panel, how do those components get differentiated
- Should a tool warn when components from different architectures are mixed, how does the tool know when such mixing of overlapping components or architectures is intentional
- Should the tool promote one architecture's components over another, or provide user preferences to control promotion, and how flexible do those preferences need to be

Next up: the current situation.
This topic has been closed for replies.

72 replies

Participant
February 19, 2009
In case you're been living under a rock ;) in response to popular demand, Adobe has decided to get rid of the Fx prefixing: http://www.adobeforums.com/webx/.59b7e849
Participant
February 19, 2009
So what's the big picture? To my understanding:
* Fx components will finally replace all Mx components after one or two years, developers will no longer use Mx in most projects.
* When Flex 4 release, we use most Fx components and several Mx components, I think very few developers will use mx/fx Button in same project.

I suggest the decision to make should be based on:
* How Flex team can work best with final Flex projects will be, not care too much on some pains Flex developers will surf. It just normal, life is pains, we go for better result.
* Which decision Flex team can develop better/solid framework. I think Flex developers need less bugs/more features than anything else.
Participant
February 19, 2009
Many good arguments on the side of namespaces over FX prefixes. So count me as another developer hoping that Adobe's business side doesn't pressure the fabulous Flex team to do what will clearly be seen as a hack.
Participating Frequently
February 15, 2009
Glad to see that the comments over here - http://iamdeepa.com/blog/?p=34 were taken notice of. And I echo Joseph's sentiments, perhaps waiting until parity is reached between the current halo components and the new Gumbo one's is the best idea. Maybe not from a "lets get the product out the door and start getting some revenue" point of view, but DEFINITELY from a "let's not make life harder for our users and continue to grow good will which will in the end increase our revenue anyway" point of view.
Participant
February 15, 2009
I know this is a bit of a moot post, since the decision has been announced to be rid of the prefixing, but I think some of the finer points of this conversation bear commenting on.

Personally, I vote for three distinct namespaces:
1) one for MXML 2006/Halo/Flex 3 - xmlns:mx="http://www.adobe.com/2006/mxml" or "library://ns.adobe.com/flex/halo", whichever
2) one for MXML 2009 native language elements - xmlns="http://ns.adobe.com/mxml/2009"
3) one for Spark/Gumbo/Flex 4 components - xmlns:fx="library://ns.aodbe.com/flex/halo"

This allows the MXML specification to evolve on a separate timetable if it needs to: the next MXML specification after 2009 may not be until MXML 2011, while Flex may be into version 6 by then. This actually makes it easier to distinguish MXML as a language with its own syntax, i.e. having its own manifest file, rather than a prop for one framework or another. Having some experiemce in teaching Flex and responsing to beginner tutorials, IMO collapsing namespaces will actually make it harder, not easier, to teach and explain Flex to the beginner.

Keep in mind that people can reassign URIs to whatever namespace they see fit, so I would not get to hung up on whether a URI/manifest file is undeclared or is assigned a specific namespace name, although having the MXML 2009 be the undeclared or default namespace (i.e. xmlns="...") is a good convention.

And as for prefixing, I think it's pretty unanimous how much of a hack and forwards-compatible disaster that would be. Enough said.

As for CSS, I don't see an issue with using namespaces in CSS as Matt Chotin suggested. As for allowing/disallowing something in the CSS spec simply because global class selectors or some other technique is not a best practise is ludicrous, and this /will/ harm beginners coming to the language. There needs to be room for people to implement hacks and bad practises if they want to, because quite frankly there is a reason to buck the rules and write not-so-elegant code on occasion. I should have the option to use a namespace with a global class selector to define a style on both a halo Button and a gumbo/spark Button if I want to.

As for why people would want to use two different namespaces or packages for teh same component name in the same file, whether MXML or ActionScript, well we won't all have the luxury of coding perfect J2EE-OOP-patterns-compliant code all the time. Having come up through the Flash coding world, I know just how much hacks are a fact of life, despite how undesirable they are. I can well see a "conversion project" down the road where I'm tasked with adding Flex 4 capability onto a Flex 3 project. If I need to add to a component with 10 Flex 3 Panels but I need the functionality specific to the Flex 4 Panel, I sure as hell am not going to recode all my Flex 3 Panels if I can at all help it. I'll just live with and deal with a new namespace declaration in MXML and use fully qualified class names for some components in ActionScript. If the project is configured for both Halo and Spark component frameworks, then my tools (i.e. Flex Builder) should be intelligent enough to help me with fully qualified class declarations as well.

So the solution should not be dumbing down and simplifying simultaneous framework implementations for the sake of beginners. Beginners have already shown that namespaces are intuitive, and anyone used to coding in ActionScript should already be aware of import collisions and know how to account for it: we shouldn't be implementing hackneyed solutions so beginners do not have to learn core programming skills. And the tools should adapt to new framework/language conventions, not the other way around.

Personally, and I apologize if this sounds a little harsh, but I think the engineers at Adobe need to tell the suits to wait until equivalent spark components are developed to complement all the halo components before Flex 4 is released. And still allow for simultaneous use of different major framework versions. Unless... it is publicly acknowledged that Flex 4 will stay in Beta until this happens. Putting out an unfinished product just to meet some marketing forecasts doesn't sit too well. You want to improve Flex Builder? Fine, issue a point release of Flex Builder 3, or diverge the tool versioning from the SDK versioning, which is what landed up happening with Flash Player/Flash Authoring.
Participating Frequently
February 14, 2009
IMO separate fx namespace makes a lot more sense, especially for new users. It's confusing to see two separate mx:Button and mx:FxButton controls, and auto-completing "but" to mx:FxButton doesn't help (because he sees an FxButton whereas he was trying Button). Far more natural/intuitive is to default to fx:Button transparently.
Participant
February 13, 2009
Why not use namespaces and packages so they fall in fx.* and thus, they will all look like fx:Button vs mx:Button.

To support this, don't use xmlns="" by default. That way you will never have
Participant
February 13, 2009
Hi Matt (and all others),

concerning your post of prefix-less proposal, I have a few comments. The first is that I already like this pretty much and that I appreciate it that Adobe opens up (further) to community feedback.

Now regarding the post itself:
1) Namespaces:
You asked not to discuss too much what could go where - I am sorry for not being entirely able to follow this, however I think, the layout may provide some help for coming up with a solution that is both flexible and not too hard for newcomers (without programming/c.s. background).

1.1) Layout
(I think this was already proposed to a large extent) Form 5 namespaces as a foundation, namely:
I) The language
II) The faceless components
III) The spark components
IV) The non-overlapping halo components
V) The overlapping halo components

1.2) (Re-)Combination
Now having five namespaces may really seem a bit odd for somebody new to flash and not having a background in another programming language. So what I think could help is using import to recombine these namespaces to another:
VI) import of I + II + IV + V, could also be called the "everything from halo"-namespace
VII) import of I + II + III + IV, could also be called the "use spark wherever possible, fall back to halo"-namespace.

1.3) Default namespace:
In combination with 1.2, but also helpful in general: Make it possible to have one default namespace in css (I am a bit sceptical about the *-approach, however that could work, too).

1.4) Tooling support:
Add tooling support deciding whether to use namespace VI or VII or a custom number of namespaces (I believe that anybody who chooses this will know what he has to do).

1.5) Conclusion:
In general I do not believe that namespaces are very difficult. I have taught several undergrad tutorials and nobody had trouble with this (neither in Java nor in Python). With a bit of tooling support, I think, nobody will run into serious issues here.

2) ASDoc-Update with Architecture added:
This sounds like a laborious but manageable task, and one with a reasonable outcome.

Best regards,
Sebastian
Nate Beck
Known Participant
February 13, 2009
@benstucki - You just made me do a spit-take.
Participant
February 13, 2009
Consider this a vote against the Fx prefix. I'd rather use a different namespace. Re: CSS - I like the idea of using separate sheets for different namespaces. I don't like the idea of writing style selectors that include the namespace, because CSS doesn't have support for that in the specification and it could cause collisions with class selectors. You could extend the specification if you wanted, but you'd have to support your unique syntax forever, even if the CSS spec was someday revised to include a way to support namespaces.