JavaFX snubs XML and takes a step backwards!

by Michael C. Daconta

A few months ago I wrote an article for Government Computer News on the battle over Rich Internet Applications. At that time, I thought it was odd that the other major contenders, Silverlight and Flex, use XML and JavaFX does not. I wonder, if in the rush to push something out the door, Sun forgot about separation of concerns and the benefits of skill specialization to quality production. I see the trend towards declarative User Interfaces as a good thing - the proper domain of graphic designers - so, why did Sun seemingly take a step backwards? If you are a JavaFX guru, I am interested in understanding this. I found a good simple way to compare these techniques was the bubblemark site which programs a simple animation in all three (and many more) variants. What are your thoughts on XAML versus MXML versus JavaFX? In looking at the bubblemark application I still feel that MXML is the cleanest. This definitely will require some more looking in to... in the meantime, see you in the trenches. - Mike


2008-05-10 00:48:57
I am a Microsoft developer and have the #1 site for XAML, but I also own http://OpenAjax.Com - a site dedicated to OPEN RIA, so I have an unique perspective.
It is amazing that the 'rich' apps take so long to load and are slower to run than DHTML. I know from experience that a guru proficient in a 'simple' language can create a more efficient application than a solution done in a more complex toolset developed quick and dirty. However, which application was faster to DEVELOP? And, if you have a domain expert in the RIA, they can usually optimize the final result.
There are many ways to skin a cat, but I think you have nailed the BIG problem: where is the abstraction layer? Maybe they thought if they skipped XML and jsON, that the solution would be faster because it did not have to process complex datasets? DUMB
2008-05-10 01:34:31
JavaFX _is_ a declarative language, it's just not XML.
Michael Daconta
2008-05-10 03:48:49
Thanks Ric for your post and I will check out your site!

I agree with your hypothesis that this could be related to speed but that really doesn't hold water as an argument for ignoring an abstraction layer because the JVM was a compromise of speed for reliability.


- Mike

Michael Daconta
2008-05-11 04:48:24
Hi Richard,

Yes, I did notice from examining the examples that you can specify the field values in the JavaFX UI declarations but even that is out of kilter - not the way you normally do it in Java and not the way you do it in an external XML document. So, while it is declarative, I think it loses the benefit of being declarative.

Seems to me like reinventing a perfectly good wheel,

- Mike

Terry Laurenzo
2008-05-11 09:12:34
If we could all get over the false premise that "Declarative == XML" then the world would be a happier place, imo.

Just to offer some perspective, you clearly work in a community where specifying programming constructs in XML is considered to be a nirvana, and that is fine. There are many of us, however, who fully respect the journey that XML has taken the industry down over the past 10 years but simply don't like using it as a programming language (declarative or not).

Which way is right? Probably "neither" and "both". I don't see any reason to say that JavaFX is a step backwards for the sole reason that they chose not to express the UI scaffolding in XML but instead created a DSL which is designed to be expressive within the bounds of the problem they were aiming to solve.

Michael Daconta
2008-05-11 09:35:32
Hi Terry,

I did not say that declarative == XML exclusively - however, XML is a simple and well-known format for declarative constructs.

As for specifying programming constructs in XML - I was not asking for that and I do not think that is a good approach. The point was that a user interface is a fairly static construct and therefore a good candidate for a declarative syntax expressed in XML. The imperative parts of a construct should stay within an imperative programming language.

As for why I believe it is a step backwards, it is because they lost the ability to separate and specialize GUI development to graphic designers. As I said, IMO that is basic separation of concerns. Also, there is ample precedent with XUL, XAML and MXML ... in fact, why didn't they just use XUL? Such reuse would be another boost for open source and Mozilla.

We may just have to agree to disagree,

- Mike

Sean Reque
2008-05-14 10:48:07
XML is a great tool for simplifying communication between processes, but it provides a horrible syntax to write code in. XML was designed to make parsing it easier, not to make typing in it easier. Note that I am not saying that XML itself is bad, just that it wasn't made to programmed in.

Of all the syntaxes I have used to manually generate text to be interpreted by another program, XML is the least effective. Kudos to Sun for not using XML syntax for the JavaFX language!

Michael Daconta
2008-05-14 14:03:13
Hi Sean,

I think you may have misunderstood the post. I never said that XML should be used for programming. Programming uses imperative syntax in that it gets executed so its behavior is indeterminate in static form. A declaration of a user interface is a static design activity. That can and should be done in XML just like XUL, XAML and MXML are doing. I think XML does that pretty well. For example, people seem pretty comfortable using tags to markup content in html pages.

So just to make sure everyone understands, I am not advocating XML for programming language syntax.

- Mike

2008-05-16 07:20:35

I agreee, XML is a good thing to use for development, but it can be used for much more than the user interface.

I'm just begining to look into the world of declarative development and it seems pretty clear (to me at least) that the best thing about using declarative languages is that it seperates the developer role from the programmer role.

The developer defines and builds. The programmer solves problems.
The developer works declaratively (e.g. in XML), with the programmer working at a higher technical level; the problems solved by the programmer are then exposed to the developer in XML.

I was pointed to Factonomy who seem to be making good progress (though they go a lot further than declaring the user interface only) though they're only in the Microsoft world. Also, OpenLazlo seem to be doing some interesting work too.


John Bryant
2008-06-13 05:25:02
Good! When you have to start building parsers in hardware you should step back and review your decision to use that data format. I'm still scratching my head as to how XML got as far as it did. No matter the language used to consume XML, the API is always a thousand time more difficult to use than XML is to read. Its time to dump XML and just except JSON for all the obvious reasons...
Dominic Cioccarelli
2008-07-13 03:16:11
I'd repeat my comments from a couple of years ago:

... My only concern, and this is a big one, is that I feel that XML is inappropriate for scripting (which is essentially what we are talking about when it comes to building user interfaces).

XML (and HTML) are document mark up languages. They perform a this task very well but are completely inappropriate as scripting languages. XUL isn't the only perpetrator in this regard, another classic example of an inappropriate use of XML is in ant build scripts.

I really believe that XUL would be much better off if it lost the X and was just a browser interpretable scripting language (JavaScript?) which was used for describing user interfaces....