Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.c++ > #68327
| From | Paavo Helde <myfirstname@osa.pri.ee> |
|---|---|
| Newsgroups | comp.lang.c++ |
| Subject | Re: Action/logic inside or outside the Windows class? |
| Date | 2019-09-11 18:22 +0300 |
| Organization | A noiseless patient Spider |
| Message-ID | <qlb3ff$e8j$1@dont-email.me> (permalink) |
| References | <Jb4eF.975226$dw4.193344@fx12.am4> |
On 11.09.2019 13:41, JiiPee wrote: > I know this is not Windows programming forum, but because I think this > is more like a C++ expertise question (and not Windows) I ask here. > > So lets say I have a window where I show text after some mouse click. A > naive program, but just to keep it simple. > The question is that should I have only windows-related code in the > Window class and create another class dealing > with the logic of the program? In general, yes, in the Window class you should have only windows-related logic. Another way to think about that is that you want to put all your program logic under unit tests control anyway. Simulating mouse clicks for unit testing might not be so simple and would mix up testing the GUI and the program logic, so most of the program should be testable without GUI. So ideally you should first write your program logic classes together with unit tests. Once the functionality is working and the tests are passing, only then start adding windows related classes to expose this functionality in GUI. Refactor, rinse and repeat as needed, unit tests are now there and holding the functionality intact.
Back to comp.lang.c++ | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 11:41 +0100
Re: Action/logic inside or outside the Windows class? Öö Tiib <ootiib@hot.ee> - 2019-09-11 06:45 -0700
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:28 +0100
Re: Action/logic inside or outside the Windows class? Öö Tiib <ootiib@hot.ee> - 2019-09-12 01:05 -0700
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:45 +0100
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:53 +0100
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 15:58 +0100
Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 18:22 +0300
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 16:45 +0100
Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 19:12 +0300
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 17:51 +0100
Re: Action/logic inside or outside the Windows class? red floyd <dont.bother@its.invalid> - 2019-09-11 09:56 -0700
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 19:42 +0100
Re: Action/logic inside or outside the Windows class? Paavo Helde <myfirstname@osa.pri.ee> - 2019-09-11 20:24 +0300
Re: Action/logic inside or outside the Windows class? JiiPee <no@notvalid.com> - 2019-09-11 19:42 +0100
csiph-web