This document aims to combine the experience of many of the top KDE developers about Qt and KDE frameworks dos and dont’s and provide a good source of advice to new KDE programmers.
This document aims to combine the experience of many of the top KDE developers about Qt and KDE frameworks dos and dont’s and provide a good source of advice to new KDE programmers.
In my opinion… C++. Compilers are dogslow and language is lousy complicated. C++ is good language for students (frankly speaking for exams which student can easy fail)… I think another serious problem of Qt (and GTK even more) is toolkit extendig… Let’s look at Delphi components library… There are bazilions of widgets out there. Why? beacause code reuse and gui tools extending as as easy as piece of cake. Delphi can be source of healing concepts for other tools. Very clean language with light-speed compiler which can recompile complext houndred-of-thousands-line preject recompile in just few seconds where prototyping, debugging and fine-tunning of apps takes just a while… C is good for low-level programming C++ is not because of lousy integration with other tools (cross-linking) but both languages are horrible for gui programming. They aren’t productive they has many traps for programmer and it’s compilation is slow… Even Microsoft had seen the power of Delphi… Windows.Forms are more Delphi/VCL-like than MFC-like (MFC-another sick concept)… I hope linux fans some day would see the power of Pascal/Delphi.
I’m not really fully knowledgable in this topic, but I wonder. How fast and responsive would a full DE like the K be if it was coded in Delphi? Isn’t performance the main positive point of those two difficult languages?
I write Delphi code for a living, and Delphi performs very well (when your application is coded properly, of course, as with any language).
That’s good question… VCL/windows is based on w32 API which is as we know C-based – there were never been any responsiveness questions of Delphi apps on Windows. In Kylix thigs look different. LCL is qt based so there could be no comparison. In my Windows practice I’ve used many VCL based (no VCL wrappped) windows controls and they seemed to be as speedy as or faster than Windows API ones… Of course sometimes Delphi is not as fast as C for data processing but other tools/languages aren’t also. Delphi is good compiled language with performance beetween C and JITed Java… Memory footprint of Delphi apps is also far better than java and no wose that those in C. In event dipatching which is base of GUI system Delphi is noworse than C++ (virtual method call costs the same) and other performace factors comes from Windowing System which is (and has to be) coded in C.
Well, one thing is to use the components, and the other is to write the components. The article is more about writing the components.
Delphi is a one platform development environment, and Kylix has failed miserably on Linux. Delphi enjoys the Windows optimizations and APIs (the interesting thing is that Delphi 8 is for dotnet already).
I use Delphi at my work as well.
Back on the topic, it’s good to see some clean advices like those.
@ mike:
> C is good for low-level programming C++ is not because
> of lousy integration with other tools (cross-linking)
I’m currently working on an operating system kernel written in C++. True, both for the interface to the Assembler parts (bottom layer) and for the interface to user space (upper layer) I have to use ‘extern “C”‘ declarations. But that’s part of C++, too, and I really don’t see where you perceive issues with “cross-linking” there…
Pascal is a bit higher language than C, the advantage is that there is more opportunity for the compiler to optimize the code. In my opinion (Object) Pascal has a very good balance between high/low languages and is clean.
BTW. The Native Oberon-2 operating system, is almost fully written in Oberon-2 (a newer member of the Pascal family): http://www.oberon.ethz.ch/native/
Well, if you don’t want to use C++ for your Qt/KDE apps, use Python or Java. You don’t have to use C++… But Qt makes C++ as easy as Java to use for GUI apps — maybe even a bit easier since Qt is easier to code against than Swing.
It took me about a month to get productive with KDE, Qt and C++, but then, I already knew the Qt API from PyQt.
BTW. Native Oberon is Oberon based (not Oberon-2). It the operating system + compiler + TCP/IP stick fits on one
1.44MB disk.
Just one thing on Kylix failure… This failure have only political/commercial reasons not technical ones… Xpde is proof for that. So Kylix end has nothing to our arguments…
Another thing is that the strength of toolkit is also that the component user can easy also be component writer (there is no need to deiffer)- if he has to have some magical abilities to write the component and use it in its favourite RAD tool and both Qt nor GTK can this I think….
go Delphi..
.DOT.
Just afer you use extern “C” you are just out of OO concept of C++ – it’s just native bridge between C and C++ but extern “C” interfaces can be as OO as GTK… If your lib is OO you just can’t use it outside C++ (name mangling, calling conventions, inline code etc…)
I trust you are productive in KDE… good 4U… But if there is one small change in your Dialog class interface there is a need of recompilation of plenty of your modules which for KDE and regular PC takes minutes… Please have a trial version of Delphi and try to build some app. It will take you less than week (u are KDE geek).. and U will love Delphi… Trust me.
And finally you will know what I mean telling productivity…
PyQt is good tool but it can’t be meant as nothing more than the “scripting glue” of Qt which has to be up-to-date with Qt and cat easy extend widgets library… Performance od PyQT is sufficient for GUI wrappers for scripts and simple tools, but can’t be considered as serious apps’ platform…
> …But Qt makes C++ as easy as Java to use for GUI apps
> maybe even a bit easier since Qt is easier to code against
> than Swing.
Easier! Easier for whom? I’ve been writing swing code for years (since Java 1.2, the beginning of swing) and a significant (but lesser) amount of QT code in C++. I personally find swing’s event model a lot more pure and understandable. Not to mention, the Java language is much simpler. The Java language doesn’t fall short as I only rarely could have used multiple-inheritance and generics capability is on the way. I also find garbage collection to be very convenient.
If you used swing to much of an extent, I think you’d agree with me.
Great language, problem? only available on Linux. What Borland need to do is open it up, work with mono and create a framework in which delphi can exist as a first class citizen but also able to run on more than just Linux.
Easier for me… And I have done both. Years of Java professionally, not quite as long Qt/C++ for KDE (working on Krita), and I wrote the book about PyQt, not to mention several articles for Dr Dobbs. I prefer Qt’s API in all three languages.
And I know of several large applications written in PyQt of which Eric is perhaps the most accessible for the general public. PyQt is more capable than simply gluing widgets together for small scripts.
I think you are one of the people who mistakes Pyton for a scripting language, probably caused by all who prefer/compare Pyton to Perl. Pyton are a general purpose programming language. But since it’s a interpreted, simple and easy to learn language, Pyton also make an ekselent scripting language.
With Pyton and PyQt as a tool for making applications you could probably place it between Visual Basic and Delphi preformance and capability wise. All PyQt functions and classes are pure C++, so you get no preformance loss compared to using them in a standard C++ app.
For me Java/Swing/AWT is by far the superior solution.
Apart from the more intuitive Java-Event-Handling and garbage collection, Java applications compile in a few seconds, QT/KDE-Apps need minutes.
The disadvantage is the gui-performance but there are dozens advantages of java.
Programming with java is so much easier and faster.
One example: you can have a main() inside every class to test it “standalone”. That alone makes debugging so comfortable, you can never reach it with C++. You waste endless amounts of time with debugging C++-stuff compared with Java.
Java source code is easily cut by 50 % compared to C++. And you don’t have that antiquated seperation between header and implementation.
And with today’s cpus an adequate programmed Java-application is very responsive and it looks good.
The disadvantage is the gui-performance but there are dozens advantages of java.
Programming with java is so much easier and faster.
But it’s slow (talking about swing), so all the advantages of Java lies with the developer, not the end user.
“Great language, problem? only available on Linux. What Borland need to do is open it up, work with mono and create a framework in which delphi can exist as a first class citizen but also able to run on more than just Linux”
Uhm, Delphi is for Windows. Kylix is the Linux port of Delphi.
The newest Delphi uses Microsoft .NET.
One example: you can have a main() inside every class to test it “standalone”. That alone makes debugging so comfortable, you can never reach it with C++. You waste endless amounts of time with debugging C++-stuff compared with Java.
Java source code is easily cut by 50 % compared to C++. And you don’t have that antiquated seperation between header and implementation.
That depends on your implementation/design, you can easily embed a check/debug function in each class (you can reduce bloat in the release version by using debug macros). I think your figure of 50% is a bit too high. As far as I can say c++ is harder as it gives you much more power than java. Java is easier because it is essentially a subset of c++.
“But it’s slow (talking about swing), so all the advantages of Java lies with the developer, not the end user. ”
Ah, SWT is faster eh? Popular comment, but never seen any metrics that back it up.
I’ve always been impressed at JEdit’s start times and drawing ability. And it is pure Swing. http://www.jedit.org
> The disadvantage is the gui-performance [java]
And this is enough to disqualification of java as desktop application tool. The same for time of compilation. Argument ‘C++ is slower in compilation’ means NULL. Time of execution for end-user is everything.
Reading the language argument is brings to mind a discussion I had the other day about Mono. Apparently the truly cool part is that multiple languages can integrate into a single project with the same API.
So this way you can all agree and hush up about language superiority because soon enough they will interoperate anyway. At that point you can take advantage of c’s speed for your real process work, and use something easy like pascal, python, or another language for your interface.
It’d be nice to see this happen IMO. Personally I prefer to write things in c++, it’s my language of comfort and I don’t find it all that difficult (maybe a bit time consuming though). And I am doing some GTK+ stuff with c. I’ve never done anything in Delphi.
Yes, you know what I bloody mean. It is only available for LInux AND Windows, Big woop. What about those on MacOS X? Solaris? FreeBSD?
Both Delphi and c++ are fast compiled languages with fast execution. (c#/java have vm’s).
The “trade off” that delphi makes for simplicity is (like java/c#):
– structs/primitive/value types are allocated on the stack
– objects are allocated on the heap
– single inheritance
Thus pointers cease to be an so “in your face”. Though they are available if you want them. This results in big increase in programmer productivity.
A simplified C++ with objects only on the heap – syntax like c# – but compiled and without gc would be a good idea. It could generate the same code as c++.
Take a look at D.
http://www.digitalmars.com/d/
If the proposed “optimizations” are really necessary, Linux must use an extremely dumb C++ compiler.
D looks good. Is it opensource? GPL? Couldn’t tell from the site.
I didn’t find anything either. However there are at least two D frontends for GCC (one seems to be dead). They are under GPL.
http://www.opend.org and http://home.earthlink.net/~dvdfrdmn/d/
I didn’t find anything either. However there are at least two D frontends for GCC (one seems to be dead). They are under GPL.
http://www.opend.org and http://home.earthlink.net/~dvdfrdmn/d/
sorry for double post