2016-10-26 – A model for every view

Extract model_XY from model_XZ

My understanding of the MVC – pattern is to have specialised model for every view. Therefore I have to extract a model_XY from the model_XZ.

    ${targetNamespace}::setScalar  RearMockup  DiscDiameter

This parameter is referenced by

    set disc_DiameterDisc   [myGUI::model::model_XY::getScalar RearMockup DiscDiameter]

Found a property in the wrong context

DiscDiameter is a parameter of a brakedisc and in this case part of RearBrake. So this value should be handled in context of the Rearbrake (object-view) and not in  the RearMockup (function-view).

    dict set projDict   Scalar      RearBrake   DiscWidth       $::bikeGeometry::RearMockup(DiscWidth)      
    dict set projDict   Scalar      RearBrake   DiscDiameter    $::bikeGeometry::RearMockup(DiscDiameter)

This requires a name cleanup in the GUI and in the modelAdapter

RearMockup::DiscDiameter in the GUI


RearBrake::DiscDiameter in the modelAdapter

Dont touch the existing package: bikeGeometry

In a previous refactoring step i built the procedure to create the project dictionara in


By doing a smaller update on this procedure and in a reflexion of this implementation I think it is a better decission to place this functionality in the class


This class is part of the refactoring strategy pattern. So I created

method getModelDictionary

and copied the full body from

proc bikeGeometry::get_dictionaryGUIModel

Handle different names in GUI and Model for the same

The problem

Every parameter update in the GUI is handled here:


a switch-control forwards this call to


The procedure


handles an exception for


and forwards this call to

set_Config CrankSet_SpyderArmCount

And this should be managed in



A view on the current situation shows, that it is much easier to handle this definition in the GUI – without any later exception.

Found a property in the wrong context II

  • RearBrake::DiscDiameter
  • RearBrake::DiscWidth

This change is definitly handled here:

myGUI::modelAdapter::AdapterBikeGeometry -> set_Scalar        
        object  -> RearMockup
        key     -> DiscDiameter or DiscWidth
        switch -exact $object/$key {
             RearBrake/DiscDiameter -
             RearBrake/DiscWidth {
                     set object RearMockup

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s