Results 1 to 5 of 5

Thread: Professional Classes & Objects Structure

  1. #1
    Join Date
    Aug 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question Professional Classes & Objects Structure

    Hello, All!

    I am new to this site and really new to Qt (but I learned it for a half of year and read almost all most popular books about it). So I am newbie partially :-)

    I have a question to real Qt professionals about correct and professional classes structure.

    I do a development of software that in future will be marketed, so it needs to be coded correctly and professionally from the first line of code.

    I need your advices how to call classes, and how to model them - make them as part of one big file, or as part of small files. Then how to name it better?

    Here is what I have:
    1) Software has a main window class (QMainWindow) with QTabWidget as central widget.
    2) Software must work with projects and each project loaded in own tab on Tab Widget at main window
    3) Each project has own Properties and several working Threads.

    The good example of similar software is a Teleport Pro (that do a download of whole websites - and each project has own options, and then it can be saved/loaded/started)

    I need your advice how to assign a correct class names and how to combine these classes.

    I was read a "Designing Qt-Style C++ APIs" but didn't found all answers there.

    Exactly questions are:
    1) How to name a Projects class? Is "Project" a reserved word? If not is it good to have a class named "Projects"? Then if this class must be as collection of separate "Project" objects with own properties and methods like save/load? How better outline this? How you name your projects class?
    2) Each project will have a results buffer that will be updated by Project Threads. Does these Threads must be in the same file as projects? Or separate?
    3) Each project visually has own widgets at the Tab Widget (like progress bar, start, stop buttons etc). Do functionality to draw these widgets related to particular project must be a part of Projects file (I mean it will be like a ProjectWidget - with draw, properties and methods)? Currently I have it in MainWindow class - there is a method - CreateProject that do insert a new tab and add a widgets to tab.

    Please help.

    I know my questions maybe stupid, but I just want to have a professional software developed so need your help for every small detail. Just imagine that you creating website downloader. How you will make a classes model there? How you will name the projects and how to integrate them with threads and main window?

    Thanks.

    Dmitry
    Last edited by webstylemedia; 3rd August 2008 at 20:01.

  2. #2
    Join Date
    Aug 2008
    Location
    Ukraine, Krivoy Rog
    Posts
    1,963
    Thanked 370 Times in 336 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Professional Classes & Objects Structure

    Did you read this book http://trolltech.com/developer/books/1 ?

  3. #3
    Join Date
    Aug 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Thumbs up Re: Professional Classes & Objects Structure

    I contacted Spirit and he helped me with all my questions!

    He's a MAN!

    Thanks, Spirit!

    I think this thread can be closed now. No more questions regarding this issues.

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

    Default Re: Professional Classes & Objects Structure

    Your question has nothing to do with Qt really... It's more a question from the Software Engineering domain - how to split the system into modules and classes, how to call and reference them. There is no single recipe to doing that. A general rule should be that the naming scheme should be convenient for people implementing the software and clear enough so that if other people start working on it they won't have problems with understanding the structure of the system.

    In general a unit name should have a singular form (class should be called Project and not Projects). An instance of that or similar unit can have a plurar form (so you can call a vector of Project instances "projects"). But remember it is just a convention and in practice you can name your classes and variables the way you like and find useful, even if the whole world does it differently.

  5. #5
    Join Date
    Aug 2008
    Posts
    3
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Professional Classes & Objects Structure

    Thanks wysota!

    Yes this question was related to software engineering. I just didn't know where to ask it.

    I already found an answers with "spirit".

    Next time I am sure I will have more qt-related questions related to QThreads, QHttp (maybe QTcpSocket because now dunno what better to use in Threads), etc.

    Thanks, guys!

    D

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.