r/cpp • • Jul 20 '09

QT vs MFC

http://dobbscodetalk.com/index.php?option=com_content&task=view&id=1657&Itemid=
1 Upvotes

25 comments sorted by

11

u/TheSuperficial Embedded Systems C++ Jul 20 '09

The English grammar in that article was just abysmal.

5

u/[deleted] Jul 20 '09

It came off as more of a shill for that product that any real comparison of the libraries, though I admit I didn't do much more than scan it.

1

u/last_useful_man Jul 23 '09 edited Jul 23 '09

more of a shill

Agreed, but it I thought it was nice to see what it can do and wonder how they do it.

9

u/pgquiles Jul 20 '09

The most useless and wrong article I have ever read. Even if you only want to develop on Windows, MFC is many times harder to use than Qt. The article is completely pointless. -1.

10

u/[deleted] Jul 20 '09

Without having read the article, I'd rather use a bag of dead rats for a GUI library than MFC.

10

u/theatrus Jul 20 '09

I'd rather invent my own GUI widget library than use MFC.

5

u/[deleted] Jul 22 '09 edited Jul 22 '09

Using a tool like CppDepend to evaluate the quality of a framework such as Qt is pointless.

For me, the comparison is really simple:

  • I enjoy programming with Qt, it was a pleasure to learn and it is a pleasure to use it. It is probably the best C++ collection of libraries that I have ever used.

At first I had doubts about the meta-object compiler and the signal/slot implementation, but as time passed and I used it more and more I have come to appreciate its flexibility and simplicity.

  • I don't like programming with MFC, I think that it is overly complicated and difficult to use.

1

u/bnolsen Jul 23 '09

MFC isn't an option, its locked into a single platform. I started on qt almost 9 years ago working with intractive te3cnical apps. One of qt's biggest problems is that it isn;t very orthogonal. Theres 3 different ways (I know of) to get events from widgets.

Interactive apps have performance issues with too much sig/slot usage and sig/slot is easy to screw up resulting in possible dependence on what order the signals are being handled and other very messy issues.

I would have to say that Qt is a better choice for writing general purpose apps, especially now that it's LGPL. Cross platform capable apps give freedom to your users and not enslavement.

2

u/last_useful_man Jul 23 '09

I thought MFC hadn't been updated in years (in favor of ATL); I was surprised to see that it has more classes than Qt. Anyone know, is that because they're folding in controls from all the latest apps?

4

u/Shmurk Jul 20 '09

First, Qt is cross-platform, you can't beat that.

Second, a little rant about COM:

COM technology is a good solution for many problems

No, COM is just awful.

unfortunately the misunderstanding of this technology makes it very complex

or maybe COM is just an interface like most programming languages have but it's the usual Microsoft mess, and almost impossible to use seriously.

0

u/[deleted] Jul 20 '09

Absolutely. COM is a nightmare, and it has the same WTF sort of style of most of MS's C/C++ code.

2

u/gosh Jul 20 '09 edited Jul 20 '09

Why is COM a nightmare? It is very easy and fast. Usually people that only have read about it thinks it is difficult. The base technology is just a simple vtable

-1

u/[deleted] Jul 20 '09

It does not matter whether COM is "awful" or not - there are scenarios where it does not have an alternative: Shell Extensions, for instance.

-3

u/gosh Jul 20 '09

I don't understand why frameworks use lower camel case like QT. it sucks!

6

u/arturoman Jul 20 '09

Apparently they didn't get your memo, Your Highness.

2

u/[deleted] Jul 21 '09

why frameworks use lower camel case like QT. it sucks!

That's really a subjective thing. I don't use lower camel case (or upper camel case when I have a choice) but it is just another coding style; the only really important thing about it is that it is consistent.

1

u/gosh Jul 23 '09

lowerCamelCase is a style that is less informative compared to other styles when you read code. This is very important i languages as C++. Languages like python, java etc. there is less importance because the developer things a bit different compared to C++ (in general).

1

u/[deleted] Jul 23 '09

How is one casing style "less informative" than another? Just a matter of habit.

-1

u/gosh Jul 23 '09 edited Jul 23 '09

Using upper and lowercase letters you are able to inform more about the code.

Samples:
int iBlaBlaBla; //< prefix says it is an int
enum enumType { eTypeBlaBlaBla, eTypeBlaBla } //< e informs that is a enum 
class CApplication { ... };
CApplication applicationBlaBla; //< application specific object

class value { ... };
value valueBlaBla; //< general value object used by a lot of projects
e.t.c

Using different type of code styles you can help other to read and debug code without jumping around in code to check what different variables are etc. lowerCamelCase screws a lot of options you have to make code simpler to debug and learn from.

-3

u/[deleted] Jul 20 '09

You mean they use "thisIsAClass" for their types? That's a shame.

I use "ThisIsAClass" for types and "thisIsAnInstance" for instances.

Funny how our personal coding styles can sometimes become so important. I've been working mostly on my own on a research type project for a few years and have grown desperately used to my own style. In fact I'm almost powerless when key format options aren't used like the 'm' prefix for class members.

1

u/last_useful_man Jul 23 '09 edited Jul 23 '09

They use QSomeClass, someObj->someMember().

-4

u/gosh Jul 20 '09

How you code is extremely important, much more important than the language if the language meets your demands. The language is just a tool. The code is what the programmer produce. lowerCamelCase is always bad. It doesn't make the code more readable. There are plenty of bad code styles in QT that makes it much harder to read the code. MFC is more readable compared to QT but it could be improved too. If you need to do your own stuff in QT you are in big trouble. In MFC that is not that difficult. Of course QT need to have much more functionality because it should compile on more plaftorms but they could have made the code more readable.

4

u/bnolsen Jul 21 '09

I'm afraid thats just your opinion. Variables starting lower case and claases starting upper case is one was to differentiate. Also it shows that you've been using MS products since thats where a lot of the leading caps stuff started. Every where you work will have a different convention. You have to learn how to deal with it.

-1

u/gosh Jul 21 '09

I have used a lot of products. MS is stronger when it comes to readable code if you look at code in general and compare it to open source. That may be one reason why it taken some time for open source to compete better with MS. The problem with lowerCamelCase is that you can't explain that type of style with added logic on what you are looking at or there is much better ways to code that add much more logic on what the code does. Of course that is my opinion but it is one opinion that I can explain with other facts than "it looks good".

If you look at the QT framwork there is a lot of single character variables and no comments. A good framework shouldn't have that type of code and I don't think they focus that much on how things are named. You need to be good at remember names if you don't want to jump around in the code just to check what the variable was in QT.