design question - logic and interface separation
Posted on 2012-04-03
I have a fairly large existing app that runs on a sort of event simulation. It's an MFC app that has the mainframe currently responding to events in the business logic code. Since now I'm interested in making a more clear separation between the business logic and the interface, I'm wondering what the best way there is about sending the messages. This is my current idea:
Whatever messages handlers exist in the mainframe should be pulled into another class. Let's call it my controller. Since the messages are coming in on my event queue in mainframe (from other worker threads running), my controller class seems to need its own event queue that I can PostMessage to. Is this correct? Should I make a CWnd-derived class to replace the mainframe so that I get an event queue for free? (this seems very wrong to me). My ultimate goal is to remove all GUI from the existing app and communicate all of the GUI items through a socket interface where multiple machines can get the interface update messages through the controller class and do their own interpretation of what the GUI should show (for different kinds of machines).....
Thanks for your help!