Results 1 to 4 of 4

Thread: organized or no?

  1. #1
    Join Date
    Jun 2007
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default organized or no?

    The thing that skeered me away from mfc was the c++ - class overrides, multiple files were created for different things like view, io, etc.. I went with win32 (one .cpp and one or more .h files )..

    Can I put everything into one .h and one .cpp file - at the risk of answering my own question, probably yes but it won't be easily maintainable.

    When would I know to put an aspect of my application in its own file/class?

  2. #2
    Join Date
    Feb 2007
    Location
    Philadelphia, USA
    Posts
    255
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    43
    Thanked 21 Times in 21 Posts

    Default Re: organized or no?

    Quote Originally Posted by drarem View Post
    When would I know to put an aspect of my application in its own file/class?
    In my experience, it's better to err on the side of creating too many files, because it encourages modularity. It's good to organize your development style so that creating/managing a new file is not a penalty.

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

    Default Re: organized or no?

    The traditional C++/Java/OO approach has been one header (.h) and one implementation (.cpp) file per class. If you design your classes sensibly, this makes maintenace easier.

  4. #4
    Join Date
    Jan 2006
    Location
    Netherlands
    Posts
    56
    Qt products
    Qt3 Qt4
    Platforms
    Windows
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Default Re: organized or no?

    Quote Originally Posted by Brandybuck View Post
    The traditional C++/Java/OO approach has been one header (.h) and one implementation (.cpp) file per class. If you design your classes sensibly, this makes maintenace easier.
    Thats the method i would stick too mostly, there are some exceptions though.... for example if i subclass a QListView and use also subclassed QListViewItem's i put them together in one .cpp and .h file. But i prefer to have one cpp and h file per class.
    ..:: Still Standing Strong ::..

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.