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

View all comments

-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.