Why not Java?
-
Hello,
I am a C++ programmer, and I am needing to write GUI applications. So I naturally gravitated to QT and purchased one of Jasmin Blanchette and Mark Summerfield's excellent books. I understand that QT 5 will make a major departure from C++ though. I understand that the "native" (underlying) language will be QML, and the application code will be JavaScript. My question is this: if I have to learn a new language (JavaScript), then why not learn Java and Swing?Please don't misinterpret me here. I am certainly NOT bashing on the QT folks for their decisions about how to move forward. I just want to learn how to write GUI apps using a modern object oriented language. I want to get the job done, but I want to learn marketable skills in the process.
Thank you all in advance for your comments.
uvotguy
-
[quote author="uvotguy" date="1329930779"]Hello,
I am a C++ programmer, and I am needing to write GUI applications. So I naturally gravitated to QT and purchased one of Jasmin Blanchette and Mark Summerfield's excellent books. I understand that QT 5 will make a major departure from C++ though. I understand that the "native" (underlying) language will be QML, and the application code will be JavaScript. My question is this: if I have to learn a new language (JavaScript), then why not learn Java and Swing?Please don't misinterpret me here. I am certainly NOT bashing on the QT folks for their decisions about how to move forward. I just want to learn how to write GUI apps using a modern object oriented language. I want to get the job done, but I want to learn marketable skills in the process.
Thank you all in advance for your comments.
uvotguy[/quote]
No you need to be corrected.C++ is not going to depart any time soon,very unlikely,C++ is still the main programming language for Qt 5 as far as desktop apps are concerned.but this topic has been discussed numerous time.You can search the discussions on this topic in the General and desktop forums or you can also read the discussion here.
-
QML is most certainly not the "forward" direction of Qt, it is more of a side branch to make development a bit quicker and easier, QML is just for trivial small mobile apps, even thou it is extendible through C++, I doubt people will rush implementing their business logic in JS anytime soon. That is the good thing about QML - you can implement your high performance logic in c++ and swipe all the complexity under the carpet and use the QML front end to save time. And with the QML profiler you can easily pinpoint hotspots and work a lower level solution to sluggish QML/JS performance.
I myself was pretty skeptical and suspicious of Qt Quick but it is really neat and easy, and will jump on the QML bandwagon as soon as QtQuick2 hits a more complete state. It is much easier to use and extend than any other similar GUI interpreted language out there, compared to what Microsoft or the Android SDK offer it definitely spells out "winner".
As for the burden of "having to learn JS" - if you already know c++, JS is a piece of pie.
-
[quote author="ddriver" date="1329933600"]QML is most certainly not the "forward" direction of Qt, it is more of a side branch to make development a bit quicker and easier, QML is just for trivial small mobile apps, even thou it is extendible through C++, I doubt people will rush implementing their business logic in JS anytime soon. [/quote]
The cool thing is that Qt is an open source project so there are lot of directions :)
"uvotguy":http://developer.qt.nokia.com/member/119929, do not worry C++ is Qt's leading programming language and a really lot of apps rely on it! I would recommend you to stick to Qt C++ framework because it is much faster than Java and your GUI will run on multiple platforms.
-
Not to mention much more memory efficient. I recently devoted time investigating Java vs C++ performance and efficiency, and while on average Java is only twice as slower, in terms of memory usage things are far uglier.
-
[quote author="uvotguy" date="1329930779"]My question is this: if I have to learn a new language (JavaScript), then why not learn Java and Swing?[/quote]
FYI Swing is going away in favor of JavaFX. Besides that Qt blows java's doors off (CPU, Memory, ...) which is why I'm slowly migrating all my UI apps to Qt from Swing.
-
[quote author="ddriver" date="1329935095"]Not to mention much more memory efficient. I recently devoted time investigating Java vs C++ performance and efficiency, and while on average Java is only twice as slower, in terms of memory usage things are far uglier.[/quote]
C++ can be the most efficient language in terms of memory management this has to be concerned with the person or company using C++.C++ in the hands of an inexperience developer can be a disaster.
But since Qt is taking care for most of the memory management problems (actually mistakes) Qt has made life easy for even the in experience developers.
-
Yes, Qt makes C++ resource management fairly straightforward. Alas, C++ is not more efficient than C in terms of performance and memory footprint, but development in C is tediously slow.
On average, I'd say C++ loses about 5% to C but the development time is decreased dramatically, and in my book that is A GOOD DEAL. Saving me half the code and even more time at the price of 5% performance and memory footprint I can live with. And this is only C++ vs C, with Qt the benefit is far more significant.
Java also does this but at a dramatically higher cost, an average full 100% performance penalty and anywhere between 200-800% memory footprint depending on the scenario, so much that IMO it is not really worth it. Qt is not the most memory efficient framework and still it is much better than Swing, which is pretty much a done deal. I know Java is marketed as "code once, run everywhere", but there is a little more objective version of that slogan "code once, run like cr@p everywhere, as long as there is a VM for that platform"
That being said, Java is not a bad language, there are certainly much worse, but it is suboptimal.
-
Yeah, C++ isn't going anywhere. QML is simply a script reresentation of things you can do with the C++. Whatever you can write with QML/JavaScript, you can also accomplish with more flexibility in C++ (that will always be the case). That being said, if you compare QML/JavaScript to HTML/JavaScript, you'll see that QML is so much better.