A little bit more...

Sunday, April 10, 2005

How about writing your GUI as XML files?

I've got an idea from the previous project our lab is involved in. We can store all the information of a GUI, including both its layout appearance and logics behind it, in a bunch of XML files, from which then we can restore the GUI with both the same behavior and the same appearance.
As I said in my previous article, in VC++ environment we can't make it because of widely used user customed Controls in addition to lack of implementation of meta data protocol (in Java it's the reflection mechanism). But on JVM we can get every control's properties, if not all, through Java's reflection mechanism. So it is likely that we can replicate, of course not through copying binary files, a given control written in java.
However, technology is just technology and is useless if it is not practical. Now I just don't know where it can come into play. I know in MS's next generation OS Longhorn there will be a new graphical architecture, Avalon, which allows writing GUIs just like writing HTML files , and which, I wanna mention, uses XML files as the intermediate representation of GUI. That's very similar to my idea. But MS sets up an environment, a some kind of parser or engine, for use of these XML files. But in a common system not as large as a OS, I can't figure out what this technology can be used for, although I think it's not a bad idea and I subconsciously feel that it will be useful.
So I have to further think about it. And if anyone got idea on how to use this technology, please leave a comment. You'll be very appreciated.

2 comments:

Anonymous said...

It's highly possible I'm missing a hiden funny subtext here, but plenty of people have thougth of XML-as-UI-definition. Setting aside the flaws in the various implementations, they all end up looking fairly crap - creating a nicely laid out UI always ends up being far harder when using XML than when using a proper language (XML us not a language, and is even poorly suited to configuration IMHO).

For examples of XML-defined UIs, look at XUL (http://xulplanet.com/tutorials/whyxul.html) - used to create Firefox, Flex (http://www.macromedia.com/software/flex/) or even Thinlets (http://thinlet.sourceforge.net/) alongside Avalon. I'm not saying that creating nice UI's using XML isn't possible, I'm just saying it always seems to be more trouble than it's worth. Generic UI frameworks handle the generic cases easily, but proper UI's typically require tailoring for the important exemptions.

Kenyth said...

Thanks for commenting. I've got your idea and I'll think about it. Last, but not the least, just feel free to speak out your idea here. You're always welcome here:)

About Me

My photo
I'm finishing my master degree in Software Engineering, Computer Science. I believe and have been following what Forrest Gump's Mam said: you have to do the best with what god gave you.