Mixins for Model-View-Controler

Parameterised mixins and modelview-controller

Ceda makes heavy use of the model-view-controller pattern, but in a very unconventional manner. The idea is to use parameterised mixins to write a single class that internally combines the model, view and controller into a single object.

The basic pattern is illustrated with the following code


$class MyMVC isa IWidget
    model
    {
        // model variables go here
    }
    mixin
    [
        MyViewMixin
        MyControllerMixin
    ]
{
};

MyMVC is a class that supports persistence. It has a single model which supports schema evolution and this feeds into the start of the mixin chain. As a result all mixins have read and write access to the model variables. Note that this access is through the appropriate read and write barriers. Therefore when the view mixin(s) read the model they automatically establish dependencies for the Dependency Graph System. Also when the controller manipulates the model variables, operations are automatically generated against the model. These operations allow for interactive and non-interactive collaboration amongst multiple users, configuration management etc. Note as well then whenever the model variables are changed (either locally through the controller, or remotely due to the execution of operations received from other computers), the dependent caches will automatically be marked as dirty. Therefore there is no need for the programmer to be concerned with the observer pattern between model and view.