title: How to properly notify logic layer of modifications in model layer?
body: <p>I've been searching for a few days about how i should correctly implement GUI based applications. The part that blocks me currently is how to notify the logic layer of modifications that occured in the model layer.</p>
  
  <p>Even though i will probably use Qt/C++ for it, i'm more looking for a general idea of what is a good implementation for that.</p>
  
  <p>When it comes to using the model layer, i imagine several business data objects that can be retrived from the database using DAO for examples. The thing is, if two differents views (their respective logic layer) retrieve the same database instance, they still won't share the same business data object instance, which means that when one view will update the model, i can't use the data object itself to notify the other view.</p>
  
  <p>The solutions i've been considering are :</p>
  
  <ul>
  <li><p>Giving the role to notify the modifications to the class that is responsible of storing and retrieving data objects to and from the database.</p></li>
  <li><p>Using a parametric singleton pattern based on the id, by keeping a pool of database instance, which will let the differents views really share the same business data objects and thus being able to notify each other.</p></li>
  <li><p>A mix of the two previous solutions, letting the objects being in charge of notifying the modifications on their properties, and letting the class used to retrieve and store objects in charge of notifying creation and eventually suppression of the objects in the database.</p></li>
  </ul>
  
  <p>To avoid any XY problem, what i'm trying to achieve is to keep two differents views in sync while avoiding a complicated spaghetti event system, or for example being able to implement a system that would synchronize a local database with a distant one, and automatically refreshing all views without having to tell them all to re read the database if they don't need to.</p>
  
  <p>I guess these are common problems, yet i can't find an explicit answer about how to properly resolve them.</p>
  
  <p>I hope my question is clear enough, thanks by advance.</p>