Yeah - I was trying to establish a consistent pattern across SoftwareSystem, Container, Component and DeploymentNode. A couple of alternative approaches:
In Model, when a SoftwareSystem or DeploymentNode is added then it Model could explicitly add all the children. This would be made easier if we added a children property to ModelItem which by default returned an empty list but could be overridden by subtypes (e.g. SoftwareSystem would return its containers, etc.).
In SoftwareSystem, etc. we override set_model (from ModelRefMixin) to also set the model in its containers, etc.
I'm leaning toward the first approach (including the generic children) as it feels less fragile.
Yeah - I was trying to establish a consistent pattern across
SoftwareSystem
,Container
,Component
andDeploymentNode
. A couple of alternative approaches:Model
, when aSoftwareSystem
orDeploymentNode
is added then itModel
could explicitly add all the children. This would be made easier if we added achildren
property toModelItem
which by default returned an empty list but could be overridden by subtypes (e.g.SoftwareSystem
would return its containers, etc.).SoftwareSystem
, etc. we overrideset_model
(fromModelRefMixin
) to also set the model in its containers, etc.I'm leaning toward the first approach (including the generic
children
) as it feels less fragile._Originally posted by @yt-ms in https://github.com/Midnighter/structurizr-python/pull/41#discussion_r520877224_