On 21-09-15 12:09, Peter Uhnák wrote:
Thank you Stephan, I think the image is becoming much clearer.

However I still don't understand how SRP applies here:

Person>>asNameMagritteMorph
         ^(self magritteDescription select: [:each | each label = 'Name'])
asMorphOn: self

Surely this is responsibility of the tool that needs it, no?

No. It is a domain model. The person class is an information holder/structurer (Object Design, Roles, Responsibilities, and Collaborations), describing all possible uses, the user selects the one it needs.

If the morph you need depends on the context in which it is shown,
you might want to add a

Person>>asMagritteMorphFrom: aDomainContext
^(aDomainContext magritteDescriptionFor: self magritteDescription) asMorphOn: self

and do the selection on the other side

Otherwise the Person class would have to describe every single
possible scenario.

Not the scenario, but the possible combinations yes.

Or maybe the tool would puts this into an extension protocol, which
while visually places the code to Person class is actually separated
(because it's part of another repository).

For optional parts that works well, especially using MAObject subclasses with the dictionary based properties.

In any case I can always use asMagritteMorph morph asSpecAdapter in
the meantime and maybe stitch together a Spec version once I am
comfortable with Magritte.

That sounds like the right order.





Reply via email to