This is a pattern I've been using for a while. It looks like a variant of MVC but I'm not exactly sure what it's called.
See the diagram attached here: Data-View-Logic diagram
Here's a brief description of how the pattern works:
- The Logic is like the Model in MVC in that it manages the logic and the rules of the application. The difference here is that all data is kept on the Data object.
- The View is the V in MVC. Here it accepts an immutable version of the Data object when it's constructed by the Logic object. The View initializes its state from the Data and then listens for change events from the Data object.
- The Data is... the data. An object with a bunch of getters and setters, it dispatches the necessary change events when properties are updated. The view has an immutable reference to this object and refreshes it's state when change events are heard.
From what I've read on wikipedia it sounds a lot like Presentation-Abstraction-Control but I'm not sure?
Aucun commentaire:
Enregistrer un commentaire