dimanche 26 avril 2015

Observer pattern - race condition

I would like to have your opinion about the following usage I find in OO application in C++, and whether you think it is correct or bad. We use observation pattern to imeplement model-view-controller as following:

 (Subject) (notify) (Listeners) 
 controller    --->  DB
               --->  Viewer

Is it correct to rely on the fact that DB is registed first to controller (before Viewer) and therefore will be updated before Viewer. This is critical because when Viewer get notified, it reads the information from DB (becuase it assumes that DB is already updated).

Thank you,

Ran

Aucun commentaire:

Enregistrer un commentaire