Question
specify the GUI declaratively in ActionScript like in JavaFX Script instead of MXML
After reading a bit about JavaFX Script (which is actually remarkebly close to ActionScript 3) as a developer I thought the way one can specify the GUI declaratively in JavaFX Script via JSON-like notation for the components is pretty cool. It would be nice to have something like that in Flex/ActionScript too. The advantages I see over MXML are:
1) a more compact notation than XML which is nice from a developers view point who actually writes this kind of code. Of course the idea would be that designers still design the GUI with graphical tools that generate this code but if you have to dive in and edit the code it's nice not to have to deal with verbose XML and I think even designers can easily understand JSON-like code; don't just assume that designers love XML because HTML was based on SGML! I'm not so sure if today many designers really still know raw HTML that well (like in 1997, the early days...). Server side developers probably know it better because they have to adapt it to jsp or asp or whatever framework.
2) The fact that it's all ActionScript gives a seamless integration between just composing the components to form the GUI and adding scripts to add additionial behavior instead of mixing XML with actionscript code => no more need for those nasty CDATA blocks! It would also be easy for development tools like Flexbuilder to give a seamsless experience with code completion and zooming in on the code because it's all Actionscript! There's also no need for a separate expression language to tie the MXML to the underlying Actionscript. It would it also make easier to create custom components (not just simple composition components which is really easy in MXML) because you don't have to implement separate XML tags.
here's a short JavaFX Script example:
Frame {
content: GroupPanel {
var myRow = Row { alignment: BASELINE }
var label_col = Column { alignment: TRAILING }
var field_col = Column { alignment: LEADING }
rows: [myRow]
columns: [label_col, field_col]
content:
[SimpleLabel {
row: myRow
column: label_col
text: "Type your text here:"
},
TextField {
row: myRow
column: field_col
columns: 50
}]
}
visible: true
};
Note that this shouldn't be confused with programmatically specifying the GUI in Actionscript (which is possible today as an alternative to MXML). What I propose is at a (slightly) higher level: you don't give a detailed sequence of methods/functions to call to construct the GUI (i.e. HOW to do it) but just specify WHAT you want.
Hopefully some Adobe Flex will see this and think about it. Although I think MXML is not too bad and I can live with it if I have to ;)
1) a more compact notation than XML which is nice from a developers view point who actually writes this kind of code. Of course the idea would be that designers still design the GUI with graphical tools that generate this code but if you have to dive in and edit the code it's nice not to have to deal with verbose XML and I think even designers can easily understand JSON-like code; don't just assume that designers love XML because HTML was based on SGML! I'm not so sure if today many designers really still know raw HTML that well (like in 1997, the early days...). Server side developers probably know it better because they have to adapt it to jsp or asp or whatever framework.
2) The fact that it's all ActionScript gives a seamless integration between just composing the components to form the GUI and adding scripts to add additionial behavior instead of mixing XML with actionscript code => no more need for those nasty CDATA blocks! It would also be easy for development tools like Flexbuilder to give a seamsless experience with code completion and zooming in on the code because it's all Actionscript! There's also no need for a separate expression language to tie the MXML to the underlying Actionscript. It would it also make easier to create custom components (not just simple composition components which is really easy in MXML) because you don't have to implement separate XML tags.
here's a short JavaFX Script example:
Frame {
content: GroupPanel {
var myRow = Row { alignment: BASELINE }
var label_col = Column { alignment: TRAILING }
var field_col = Column { alignment: LEADING }
rows: [myRow]
columns: [label_col, field_col]
content:
[SimpleLabel {
row: myRow
column: label_col
text: "Type your text here:"
},
TextField {
row: myRow
column: field_col
columns: 50
}]
}
visible: true
};
Note that this shouldn't be confused with programmatically specifying the GUI in Actionscript (which is possible today as an alternative to MXML). What I propose is at a (slightly) higher level: you don't give a detailed sequence of methods/functions to call to construct the GUI (i.e. HOW to do it) but just specify WHAT you want.
Hopefully some Adobe Flex will see this and think about it. Although I think MXML is not too bad and I can live with it if I have to ;)
