Currently working on an accounting application. Wrote the GUI framework from the ground up with Win32 and it works well. The issue I'm having is trying to separate the GUI from the application logic. The classes I've implemented so far are:

class Application
class MyApplication : public Application  // Is this my controller?
class Account  // Model
class Transaction  // Model
class Split  // Model
class Window  // Is this a view?  Should it hold a view?
class DataGrid : public Window  // Same with this??

MyApplication has a vector of accounts with each account holding a vector of transactions and the transaction objects holding vectors of splits

In this case I assume Account, Transaction, and Split are my models. I do not want my view to deal with these directly to separate the logic, data, and view.

What exactly is my controller? Should I add an Accountant class that both the models and my Datagrids interact with?

This would mean that my Datagrid or Table class would need a pointer to Accountant. My GUI (datagrid, window, etc.) is pretty clean now and I don't want to pollute it with application-specific code.

How do I go about separating my views and models? Does my Window class hold a pointer to a ViewBase class? My window class should definitely not contain a list of models.

1 Answer 1


A rough way to isolate components is to observe your classes:

  1. are in the model, classes that implements business logic and do not display anything nor asking input
  2. are controller classes, the ones that act on the model (in many case these classes gets input from user and then trigger actions on model)
  3. are view classes, classes that just display/represent information from the model. The information could be fetch by the view or pushed by the model depending on kind of MVC you need.

A window, may not be a view but a container for a view, or a container for a controller (button for example).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.