General Architecture - UserXXX/vCom GitHub Wiki
This page describes the general architecture used by all vCom programs.
General architecture
The general architecture used for vCom is the model-view-presenter pattern in the Dolphin-Smalltalk variant. This means that there is a triad for each view component (frame, window, panel etc.), that contains any handling logic, consisting of
- the view itself
- the presenter, which handles the events catched by the view
- and the model that represents the applications data
Implementation details
The view is allowed to listen at the model for data changes and is allowed to read data from the model on change, but it is not allowed to write anything to the model. If the view needs write access it has to call the presenter to do the write work.
The presenter is not the listener component! The view "listens at itself" and forwards events (without UI framework specific data) to the presenter. The presenter handles the event and performs neccessary operations, so the presenter contains most of the applications logic. Finally the presenter changes the model or, if no model update is made but the view needs to be updated, updates the view.
The model contains business logic that works on itself. It never directly calls the other components. Only the view is allowed to watch out for model status changes and so is the only component that is an observer.
Notice for console applications (espacially the vCom server)
Console applications have only one triad. Whenever an command is fired by the user, the view checks whether it is a read or write command (so if it only display something or writes to the model). If it is a read command, the requested data is queried from the model and displayed. If it is a write command, the command is passed on to the presenter.