|
GNOME v. KDE, December 2005 editionGNOME v. KDE, December 2005 editionPosted Dec 13, 2005 21:26 UTC (Tue) by dhess (subscriber, #7827)In reply to: GNOME v. KDE, December 2005 edition by cventers Parent article: GNOME v. KDE, December 2005 edition
From my programmer's perspective: I've used both Qt and GTK, and while I think the unstable C++ ABI is a nightmare kind of problem to deal with, I'd still pick Qt any day of the week because it's far more mature, capable and easy to use. The collective GNOME APIs are, well, muddy. Very muddy. One problem with Qt is that, instead of leveraging the C++ STL, it comes with its own STL-equivalent classes (QList, etc.). What a waste of effort! I could understand this choice 5 years ago when many popular C++ compilers still lacked ISO-compliant STL implementations, but now it's just a weight around the neck of Qt. And don't even get me started on Qt's "moc" nonsense.
I agree with you that GTK+ has a bunch of terrible API, but that's what you get when you go too far with the "OO in C" model. How C programmers can tolerate functions with names like On the other hand, gtkmm is a really nice C++ wrapper around the GTK+ APIs, and there's gnomemm for the GNOME side, too. Unlike Qt, they make extensive use of the STL, and they support the signal/slot model without the need for a pre-processing step ala moc.
(Log in to post comments)
GNOME v. KDE, December 2005 edition Posted Dec 13, 2005 22:40 UTC (Tue) by boudewijn (subscriber, #14185) [Link] Er... You know what? All that nonsense that you decry so forcibly wasstarted more than five years ago. Of course C++ standard string class still isn't suitable for real-world use, and the moc is actually incredibly handy. It's almost as if you wouldn't have to write your own preprocessor to write the repetitive stuff for you.
GNOME v. KDE, December 2005 edition Posted Dec 13, 2005 23:28 UTC (Tue) by nix (subscriber, #2304) [Link] Of course C++ standard string class still isn't suitable for real-world useThis turns out not to be the case.
GNOME v. KDE, December 2005 edition Posted Dec 14, 2005 9:28 UTC (Wed) by cloose (subscriber, #5066) [Link] Oh, yeah. The Unicode support is so great in std::string, right??
GNOME v. KDE, December 2005 edition Posted Dec 14, 2005 20:19 UTC (Wed) by nix (subscriber, #2304) [Link] std::string does not dictate representation. That's what traits classes are for. Traits classes for UTF-8, UCS-16, and so on would not be very difficult to write.
This has been true for longer than Qt has existed, I believe: certainly it was true for years before the standardization process was complete.
GNOME v. KDE, December 2005 edition Posted Dec 14, 2005 21:32 UTC (Wed) by cloose (subscriber, #5066) [Link] std::string does not dictate representation. That's what traits classes are for. Traits classes for UTF-8, UCS-16, and so on would not be very difficult to write. No, you also need codecvt<> facets to convert between different representations (UCS-4, UTF-8, etc). And that's were it gets ugly. AFAIK even "the C++ standard loving" gtkmm created there own string class for UTF-8 (see Glib::ustring). So I would say a) it's not as easy as you make sound and b) as a app developer i have better things to do and just use QString. ;)
GNOME v. KDE, December 2005 edition Posted Dec 15, 2005 10:04 UTC (Thu) by nix (subscriber, #2304) [Link] <blockquote>No, you also need codecvt<> facets to convert between different representations (UCS-4, UTF-8, etc). And that's were it gets ugly. </blockquote> Actually it's about ten lines of calling iconv. I've done it. It's not hard.
GNOME v. KDE, December 2005 edition Posted Dec 22, 2005 8:20 UTC (Thu) by oever (subscriber, #987) [Link] Actually it's about ten lines of calling iconv. I've done it. It's not hard. That sounds interesting. I've been looking for a way to handle different encodings nicely with just the STL. Could you give me a pointer to an example?
GNOME v. KDE, December 2005 edition Posted Dec 26, 2005 23:54 UTC (Mon) by Baylink (subscriber, #755) [Link] Is that the same as "bullshit"?
:-)
GNOME v. KDE, December 2005 edition Posted Dec 13, 2005 23:39 UTC (Tue) by smitty_one_each (subscriber, #28989) [Link] I think the best defense of Qt is that its roots predate the C++98 standard. Nevertheless, it's still non-standard, and loses appeal thereby.
GNOME v. KDE, December 2005 edition Posted Dec 13, 2005 23:46 UTC (Tue) by dhess (subscriber, #7827) [Link] I think the best defense of Qt is that its roots predate the C++98 standard. Nevertheless, it's still non-standard, and loses appeal thereby.Right, like I said, it made sense before reasonable STL implementations were available, but now it's just a pain. I was hoping that Qt 4 would deprecate some of the redundant classes, but that doesn't appear to be the case.
GNOME v. KDE, December 2005 edition Posted Dec 13, 2005 23:43 UTC (Tue) by dhess (subscriber, #7827) [Link] Of course C++ standard string class still isn't suitable for real-world useOh, come on, that's ridiculous. and the moc is actually incredibly handy. It's almost as if you wouldn't have to write your own preprocessor to write the repetitive stuff for you.A handy tool is great, except when I'm forced to use it. Then it's not so handy anymore; I'd call it a nuisance.
GNOME v. KDE, December 2005 edition Posted Dec 14, 2005 9:41 UTC (Wed) by cloose (subscriber, #5066) [Link] Oh, come on, that's ridiculous. Then please tell me where does std::string support Unicode? Where are the often needed features like toInt(), toFloat(), replace(), trimmed(), rightJustified(). Sure I can write all those functions myself, but I have better things to do. A handy tool is great, except when I'm forced to use it. Then it's not so handy anymore; I'd call it a nuisance. moc provides Qt Meta-Object System. This is much more than just signal/slots. It's also dynamic properties and introspection. Those things are very useful for scripting engines or GUI builders. Please see http://doc.trolltech.com/4.1/metaobjects.html. Regarding STL: There is nothing that prevents you from using STL instead of QTL in your Qt applications. Also you can even use the STL algorithm with the QTL containers. But a few things make QTL containers easier to use. Please see http://doc.trolltech.com/4.1/containers.html for reference. Bye, Christian
GNOME v. KDE, December 2005 edition Posted Dec 16, 2005 22:26 UTC (Fri) by dhess (subscriber, #7827) [Link] Then please tell me where does std::string support Unicode?Believe it or not, there are many, many C++ apps which do not need to be internationalized. I work on a very large (10m+ lines of code) in-house C++ application for a medium-sized, privately-held U.S. corporation, and all that Unicode strings would do for our application is a) slow it down and b) increase its memory footprint. Even for internationalized applications, std::string may be sufficient for storing, e.g., UTF-8 encodings, depending on what your application is doing with strings. nix alludes to this in his comment above. All you have to do is Google Groups for "unicode std::string", and you'll find several threads with postings from some very good C++ programmers debating the merits of using std::string for storing international strings. The consensus seems to be that as long as you're not trying to process the strings (e.g., find a substring), std::string may suffice. And depending on the implementation of your STL, std::wstring may be good enough for UCS-4 encodings with "real" string semantics. By the way, in my original comment criticizing Qt's "QTL," I didn't mention QString as one of the offending classes. I think it's clear that for a toolkit like Qt or GTK+, you need a portable, convenient class for dealing with Unicode strings until the C++ ISO committee cleans up the internationalization mess. (Though I would prefer a strictly UTF-8 class, can't we all just switch to this particular encoding?) So I never actually complained about QString. I was objecting to boudewijn's comment that, "C++ standard string class still isn't suitable for real-world use," which is complete nonsense. Maybe it's unsuitable for a GUI toolkit -- *maybe*, I would still prefer a toolkit that's templated on string types so that I can choose the appropriate representation for my application, e.g., I don't need multi-byte strings and don't want to pay the cost of one -- but certainly not unsuitable across the board. Where are the often needed features like toInt(), toFloat(), replace(), trimmed(), rightJustified()For toInt and toFloat, please see boost::lexical_cast. Its approach is much better than adding methods to your string class, because a) it's extensible to any type I can dream of, not just the ones that the Qt designers felt were important and b) I can override the conversion if needed (e.g., say I want my toFloat() to accept "+inf", or maybe I want to throw when I encounter that). QString's to* methods are non-virtual, so I'm SOL if I don't like their implementation.
I don't know what the other methods do, Boost may have similar functionality, but in any case, lack of these methods hardly makes std::string unsuitable for "real-world use." Millions of real-world applications do just fine without them. moc provides Qt Meta-Object System. This is much more than just signal/slots. It's also dynamic properties and introspection. Those things are very useful for scripting engines or GUI builders. Please see http://doc.trolltech.com/4.1/metaobjects.html.You're not reading what I'm saying! I don't care if moc does my dishes and takes out the garbage. I object to the requirement that I use it for my Qt application, not its convenience! gtkmm requires no such thing and I can always use moc (or any other code generation system) with a gtkmm app for all the other "good things" it does, if I choose to do so. These things should be orthogonal, not intimately tied together as they are in Qt. Regarding STL: There is nothing that prevents you from using STL instead of QTL in your Qt applications. Also you can even use the STL algorithm with the QTL containers. But a few things make QTL containers easier to use. Please see http://doc.trolltech.com/4.1/containers.html for reference.As far as I can tell, what you say doesn't apply to the Qt widget classes, since they're not templated. For example, if I want a list of selected items in a QListWidget, I get back a QList of QListWidgetItem *. So I don't see how I can avoid using QTL in Qt. Please correct me if I'm wrong, I would love to hear about it because this is one of my main objections to using Qt.
p.s. ... which reminds me of one more thing I don't like about Qt. Passing around raw pointers is really inexcusable in modern C++ design. Passing around containers of raw pointers (ala
GNOME v. KDE, December 2005 edition Posted Dec 16, 2005 1:20 UTC (Fri) by thedevil (guest, #32913) [Link] dhess wrote:On the other hand, gtkmm is a really nice C++ wrapper around the GTK+ APIs, and there's gnomemm for the GNOME side, too. Unlike Qt, they make extensive use of the STL, and they support the signal/slot model without the need for a pre-processing step ala moc.
If you keep the runtime typing inherent in the signal/slot mechanism,
And signals/slots aren't even the worst instance of this in Gtk; that
There's a reason why pretty much any Gtk app, if run manually from
GNOME v. KDE, December 2005 edition Posted Dec 16, 2005 22:32 UTC (Fri) by dhess (subscriber, #7827) [Link] I'm sorry, I'm having trouble understanding your comment. Are you talking about gtkmm, or GTK+? I was talking about gtkmm. It sounds like you're complaining about GTK+, which, as I said in my original comment, I don't like, either, so I think we see eye-to-eye on that one, at least.
GNOME v. KDE, December 2005 edition Posted Dec 17, 2005 4:05 UTC (Sat) by thedevil (guest, #32913) [Link] Sorry, I forgot that in a flamewar one's supposed to pick a side :-)
If I should summarize the sentiment behind my post (and that's the
|
Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.