PDA

View Full Version : Qt source complexity



agnus
17th November 2009, 22:54
Has anyone checked the complexity of the Qt source? What do you think about it?

I happened to check source of QString and some other Q classes today and I must say, it was a horrifying experience! :) We are talking about huge-scary-monsters!

I am no professional C++ programmer, but I do java development for a living, and I decided to get into C++/Qt for fun. Is this kind of complexity normal for all programs? For comparison I also decided to check the GTK sources and I found it orders of magnitude simpler than Qt!

-- Edit -- For example compare these:
qstring.h (http://qt.gitorious.org/qt/qt/blobs/master/src/corelib/tools/qstring.h)
gstring.h (https://dev.mobileread.com/trac/iliados/browser/upstream/glib-2.6.6/glib/gstring.h)

-- Edit -- I do realize that there is a lot less functionality to gstring; still however qstring seems like a monster to me.

wysota
17th November 2009, 22:59
I'd say Qt source code is very complex. But I'd also say it is very wise in what it is doing. Complexity of Qt code comes mostly from two things - maintaining binary compatibility across versions and "need for speed" :)

squidge
17th November 2009, 23:02
I've certainly checked it before to see what was possible and try to track down some bugs. I thought it was well documented and not that difficult to follow. What type of code would you describe as "huge-scary-monsters" ?

Some of it is more complicated than it needs to be, but I'd say that was from flexibility and enhancements throughout the years.

I've seen much much worse code at work, specially when a manufacturer has said "We have prewritten code for our chipset", and we take one look and go "!!!", and then look elsewhere for another cheaper chipset that we can develope our own code for.

agnus
17th November 2009, 23:26
What type of code would you describe as "huge-scary-monsters" ?

Hi fatjuicymole, I edited my post. See the links I put.

wysota
18th November 2009, 00:34
-- Edit -- For example compare these:
qstring.h (http://qt.gitorious.org/qt/qt/blobs/master/src/corelib/tools/qstring.h)
gstring.h (https://dev.mobileread.com/trac/iliados/browser/upstream/glib-2.6.6/glib/gstring.h)

-- Edit -- I do realize that there is a lot less functionality to gstring; still however qstring seems like a monster to me.

I'm not sure what this is to prove... that QString has more functionality including Unicode support, knows how to handle overloads and more code is inlined for speed? Yes, that's all true.

I really miss the point of comparing two completely different things :)

squidge
18th November 2009, 08:12
Hi fatjuicymole, I edited my post. See the links I put.
That doesn't really answer the question. All that says is that Qt's QString is 10 times larger and much more featureful than GTK's GString. Give the later 5 years to enhance and optimise, and I'll be suprised if they are not more similar in both size and complexity.

It's like comparing Windows 7 to Windows 3.1 and saying Windows 7's source code is huge and complex compared to 3.1's.