Seperating GUI from Logic?
-
Anyone have any advise or good reads on separating the GUI from programming logic using?
-
There is a nice "introduction":http://doc.qt.digia.com/qt/model-view-programming.html in official documentation
-
For some applications, I develop a desktop (using Qt), web (using Wt) and console version (for example http://richelbilderbeek.nl/ToolSimMysteryMachine.htm has both a desktop and webversion). My personal trick is, how plain simple it may sound, is to let the GUI do only the GUI stuff (like reading edit boxes) and feed this to a GUI-less member dialog.
For example, a QtSomeDialog and WtSomeDialog both contain the same SomeDialog. The Qt dialog reads an edit box (as a QString) and passes it to SomeDialog as a std::string. The Wt dialog reads an edit box (as a Wt::WString) and passes it to SomeDialog as a std::string.
Personally, I enjoy doing this as my architecture has -IMHO- improved.
I wrote one tiny article about the subject: http://richelbilderbeek.nl/CppFromDesktopToWebApplication.htm
Cheers, Bilderbikkel