What are the real-world benefits of declarative-UI languages such as XAML and QML?

前端 未结 4 548
北海茫月
北海茫月 2021-02-05 06:42

I\'m currently evaluating QtQuick (Qt User Interface Creation Kit) which will be released as part of Qt 4.7. QML is the JavaScript-based declarative language behind QtQuick.

4条回答
  •  逝去的感伤
    2021-02-05 07:19

    QML/XAML are:

    • Great for MVVM pattern
    • Hardware accelerated (QML with using OpenGL for Windows, MAC, Linux and Phone OSes... XAML with using DirectX for Windows and its phone version)
    • Closer to artists
    • You can create a GREAT and NICE UI using XAML/QML
    • Easier UI implementation
    • Nice animation is possible
    • In XAML, usually you can create a Silverlight version of your application just with a little changes
    • In XAML there is some great features such as Template, Trigger (DataTrigger, Trigger, EventTrigger), Binding (in any side and also both side together), Resource, Commands, DependencyProperty and Notifiable Properties.

    But please note in XAML: (I am a XAML programmer, therefore i have not points for QML)

    • XAML debugging is not possible
    • For any change in XAML, all program must be recompile
    • Be more careful for performance. For example if you use much many RoutedCommands in XAML, your application will be unusable!

    • In XAML, some feature not works as expected. There is unfortunately some tricks. (It should be clear... should works as expected... isn't it? )

    • Be careful for some similar namespaces like BitmapEffect and Effect. There is different features and costs. (e.g. BitmapEffect has some effects with software render and Effect has some effect with hardware render)

    • In real world, artists could not use WPF as Flash (at least with good performance).

    • Some features works on special places. For example DataTrigger works just in Style tag not in Resource section.

    • There is some weaknesses in XAML. Some examples: there is not any sequential animation... you cannot do any calculation in XAML (you must write a converter in C# even for a liiiittle work! JavaSript is a great replacement in QML)... some attributes are duplicate. e.g. x:Name and Name... Controlling View from ViewModel is not clear. e.g. closing View from ViewModel (you need some CodeBehind)

    • Tooooooo much run-time errors. If you use some tags in bad place it will notice you for syntax error, but many of errors occurs just in the run-time. e.g. if i target Background property (instead of Background.Color) for ColorAnimation, it will compile successfully, but in running animation... BUMP... runtime error!!! in such case on Expression Blend, application will crash!!!

提交回复
热议问题