Design Advice


#1

I used the JUCER to make my latest project, and it created three files for me.

Main->MainWindow->ContentComponent

My question now is I noticed in Jule’s JUCER(Experimental) code that in the jucer_application.h MainWindow->setProject(project*) is called, which ends up passing the pointer to ContentComponent->setProject(project*).

This requires project.h be included in both of those classes, and hard links the GUI component and DocumentWindow to the Data Model… or I could be misunderstanding? (I’m still learning about patterns, when to implement them, and when to not “over design”.) Is this cool to do? Is the the way to link your Model to your View?

Eventually I want to have several different models of processed/analyzed data sets, and several different ways to visualize those data models. Should I separate the Data Models from the GUI components more using a controller/mediator class? Or should I just hard set these pointers like in the JUCER code?

Thanks again for your advice, and thoughts.


#2

When it comes to software design, you should go for what you will need. It’s quite a simple idea, but it’s admittedly quite hard to come to terms with until you’ve actually finished something :slight_smile:

The easiest way to learn the significance of the idea is to have a deadline you have no power to change! When you’re in that position, you have no choice but to write the code needed to get the job done. In the case of the jucer, it is fine that the display components have direct access to the project, for the simple reason that it will do the job needed and won’t interfere with the goals of the application. If it needed an extra layer of abstraction to allow for some other features, then it would be written that way. It doesn’t, so it doesn’t need the extra time spent on an unnecessary layer.

If your project can’t work without something, you must design to allow for that thing. If you can achieve what you want without said thing, you should go ahead without it. It all depends on how much time you can afford to spend writing code :slight_smile:


#3

Sage Advice if ever heard it :slight_smile:

Thanks for the help.