Results 1 to 7 of 7

Thread: Qt Coding/Design Standards

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt Coding/Design Standards

    Trolltech does not recommend any particular programming style. What you choose is up to you.

    As for "camel humping", there tends to be three sorts of variable naming conventions:

    1) c_underlining: name_your_variables_like_this
    2) camelNotation: variablesThatHaveAHumpInTheMiddle
    3) mshNotation: Microsoft's Hungarian Notation

    The Hungarian Notation seems to be the most popular in Microsoft shops, because Microsoft used to heavily encourage it. But it's been shown to be counter productive. The prefixes are extraneous and if you don't get them exactly correct, you waste time in code review meetings correcting them.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Coding/Design Standards

    Quote Originally Posted by Brandybuck View Post
    Trolltech does not recommend any particular programming style. What you choose is up to you.
    That's right and there always be someone that's not happy with the current style.

    Quote Originally Posted by Brandybuck View Post
    it's been shown to be counter productive.
    Also you don't need it in C++, because it has strict type checking in comparison to C for which than notation was invented.

  3. #3
    Join Date
    Jan 2006
    Location
    Athens - Greece
    Posts
    219
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qt Coding/Design Standards

    The link that jacek provided is a must read if you are using Qt. This will save you from inconsistent naming of the underlying framework with your code. Believe me it's a relief, the code becomes readable from the one instant to the other. I am also quite a huge fun of the convention used in http://www.javaranch.com/style.jsp although java centric and although I just can't lose the m_ prefix (yet?). But I 'm a huge Kathy Sierra fan so go figure
    In any case if you are using a base toolkit that will appear everywhere in your code, stick with the toolkit naming conventions...
    I love deadlines. I like the whooshing sound they make as they fly by.
    --
    Douglas Adams

  4. #4
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Qt Coding/Design Standards

    I do not know what "notation" or "style" this is, but the standard, or more OO way to code, is naming variables like so:

    QTabWidget that is in a class:
    m_TabWconversations;

    Standard stuff in a class:
    int m_iNum;
    char m_cName;

    standard stuff not in a class:
    int iNum;
    double dbDigits;
    QPushButton qpbQuit;

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Qt Coding/Design Standards

    The last part looks like the hungarian notation and it's definitely not object-oriented and also not a standard for c++. It was created for C Windows programming and is widely explained in Paetzold's book (sorry if I mispelled the name, I don't have the book).

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.