Book a Demo

Author Topic: Advice - to nest or to compose ?  (Read 9739 times)

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +8/-3
  • Am I supposed to say something here ... ?
    • View Profile
Advice - to nest or to compose ?
« on: June 27, 2018, 04:02:21 pm »
So I am trying to represent a 'nested' relationship, specifically where an application component has sub-components (using archimate, but could equally apply to UML).
I can capture this different ways:
1. Explicit Composition relationship between sub-component and component: this shows on all diagrams but not represented in project browser (ie elements not nested)
2. Nest the sub-component within the component: shows as indented sub-component within the project browser, but no explicit relationship in the model
3. Do both: but then I'm manually ensuring that the two representations are kept in synch (which means of course that they won't)

I'm leaning toward 1 but I'm interested in hearing about others' experiences and pros / cons.
Also interested in what people use nesting for - other than for the above scenario

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #1 on: June 27, 2018, 04:57:03 pm »
Pretty sure that Paolo will give a detailed comment...

As I see it, there is no difference between structurally nesting elements and having a Nesting relation between both. EA ever had the structural representation of element and (IIRC) the Nesting operator has been introduced in a later UML version only. Now you have both of them. Personally I prefer the structural representation over the Nesting relation. One might wish that EA "somehow" handles structural nesting by also adding a Nesting relation. But I'd have no idea how this could be done smart without trampling on the feet of half of the users. So I avoided the Nesting relation and I never had the feeling to miss something.

q.

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 13523
  • Karma: +574/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: Advice - to nest or to compose ?
« Reply #2 on: June 27, 2018, 06:17:05 pm »
I would only do 1. Explicit composition relation.

I try to avoid structural nesting as much as possible as this leads to difficulties with locking, version control, etc...

Exceptions are things like BPMN processes, Activities, State Machines, Interactions. Mostly those elements that describe behavior that is owned by them.

Geert

Uffe

  • EA Practitioner
  • ***
  • Posts: 1859
  • Karma: +133/-14
  • Flutes: 1; Clarinets: 1; Saxes: 5 and counting
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #3 on: June 27, 2018, 06:42:30 pm »
Hello Matthew,


It does also depend on what you want to show in your diagrams.

If it's just the structural relationship itself, then I'd go with a composition connector. It's the simplest way, and you can easily see the relationship from the property dialog of either component, and follow it with the Traceability window.

But if you nest them in the project browser then the nesting component becomes part of the nested component's namespace. If that's something you want to show.

Another option is to create a separate component for the nested component, and in the nesting component create a property / part with the other component as its classifier. This way only the property / part gets nested, and the two components are independent of one another.
In development terms, this approach is suitable for something like a statically linked library, which has properties of its own (assigned to the classifier) and is used in several executables.


/Uffe
My theories are always correct, just apply them to the right reality.

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #4 on: June 28, 2018, 08:20:53 am »
You're thinking from a diagram-centric perspective not a model-centric perspective.  Create explicit relationships so anyone else creating diagrams from the model has access to "the truth".  They can chose to hide any relationships they do not want to show.

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +8/-3
  • Am I supposed to say something here ... ?
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #5 on: June 28, 2018, 09:16:12 am »
You're thinking from a diagram-centric perspective not a model-centric perspective.  Create explicit relationships so anyone else creating diagrams from the model has access to "the truth".  They can chose to hide any relationships they do not want to show.

Well - I'm not.
The reason I was leaning towards 1 (ie creating explicit relationships) is to ensure that the model is complete and correct - and this seems to be the right way to go, supported by pretty much everyone who has responded.

I guess where I've been confused is with the nesting behaviour that is quite core to Sparx, at least from a project browser perspective, but doesn't seem to be explicitly captured in the model. I figured it must be there for a reason and wondered what I was missing and how I should be using it.

I think the answer is alluded to by Uffe's post - it is important if you need package behaviour. So for modelling detailed behaviour and code generation I could see it would be useful. But not for what I am trying to achieve,

Thanks all :-)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #6 on: June 28, 2018, 10:39:27 am »
You're thinking from a diagram-centric perspective not a model-centric perspective.  Create explicit relationships so anyone else creating diagrams from the model has access to "the truth".  They can choose to hide any relationships they do not want to show.

Well - I'm not.
The reason I was leaning towards 1 (ie creating explicit relationships) is to ensure that the model is complete and correct - and this seems to be the right way to go, supported by pretty much everyone who has responded.

I guess where I've been confused is with the nesting behaviour that is quite core to Sparx, at least from a project browser perspective, but doesn't seem to be explicitly captured in the model. I figured it must be there for a reason and wondered what I was missing and how I should be using it.

I think the answer is alluded to by Uffe's post - it is important if you need package behaviour. So for modelling detailed behaviour and code generation, I could see it would be useful. But not for what I am trying to achieve,

Thanks all :-)
As qwerty says, I'll have a detailed comment...  ;)

Yes, you should use explicit relationships to indicate the meronymy (relationship of the whole to part), but you MUST differentiate between the Composition relationship and the Nesting relationship.  Formally, the Nesting relationship is about access/addressing (think of file in folder system) to access the file (using the normal browser analogy) you have to traverse the folders to get to the file - thus items in Sparx EA are nested in folders (see Copy Node path to Clipboard function, also Show namespace function for diagrams).   Similarly, Ports have to nested in classes (you can't conceptually have a port without its parent class). Now there is a containment relationship (a meronymy - specifically composition) between the parent (folder/item) and the child (item/folder) but that is a consequence of the Nesting, NOT the other way around!
If you merely have a pure composition relationship between the whole and the part (such as between Car and Wheels) then that is expressed as composition only.  There is NO requirement that they be visually "nested" in a browser nor visually embedded on a diagram.  (Notice the careful separation of the two concepts).  Indeed, when considering classifier models, the same meronym (part) could be composed into multiple holonyms (wholes) - Wheels in Cars and Wheels in Aircraft.  Which one should you "nest"  under (since you can only nest in one!)?
Only at the instance model level can you (as a part) only be composed into one whole.

Consequently, as part of our automated processing, we unnest things that should not be nested - even (and especially) if Sparx EA incorrectly nests them.  Part of the problem is that Sparx EA only PARTIALLY supports Nesting and Visual embedding (and in my view, some of it is just WRONG) and, as a consequence, users find EA's behaviour confusing.

Once we had conceptually separated Nesting and Composition relationships and Visual Nesting and Visual Embedding (as 4 separate, but related concepts), we found the semantics of our models improved greatly.

HTH,
Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #7 on: June 28, 2018, 11:16:14 am »
Consequently, as part of our automated processing, we unnest things that should not be nested - even (and especially) if Sparx EA incorrectly nests them.  Part of the problem is that Sparx EA only PARTIALLY supports Nesting and Visual embedding (and in my view, some of it is just WRONG) and, as a consequence, users find EA's behaviour confusing.

I think the problem is more that sometimes ArchiMate is like UML and other times it isn't, and there is no [consistent] logic to when it is and when it isn't.

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #8 on: June 28, 2018, 11:33:29 am »
Consequently, as part of our automated processing, we unnest things that should not be nested - even (and especially) if Sparx EA incorrectly nests them.  Part of the problem is that Sparx EA only PARTIALLY supports Nesting and Visual embedding (and in my view, some of it is just WRONG) and, as a consequence, users find EA's behaviour confusing.

I think the problem is more that sometimes ArchiMate is like UML and other times it isn't, and there is no [consistent] logic to when it is and when it isn't.
No, I think it's just not been thought through before they implemented.  It's a Sparx issue, not ArchiMate.  For me, it's a "first principles" thing - as per my reply in Re: Versioning with composed components.

Paolo
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #9 on: June 28, 2018, 01:04:02 pm »
No, I think it's just not been thought through before they implemented.  It's a Sparx issue, not ArchiMate.  For me, it's a "first principles" thing - as per my reply in Re: Versioning with composed components.

Any standard that is vague invites different interpretations, which will appear as not being well thought through.   

matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +8/-3
  • Am I supposed to say something here ... ?
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #10 on: June 28, 2018, 01:07:14 pm »
Ok - Paolo wins word of the day ...

Yes, you should use explicit relationships to indicate the meronymy (relationship of the whole to part)

And from Wikipedia:
"Meronymy is the opposite of holonymy. A closely related concept is that of mereology" and "Not to be confused with metonymy or meronomy"
Everyone clear ?  :)


matthew.james

  • EA User
  • **
  • Posts: 155
  • Karma: +8/-3
  • Am I supposed to say something here ... ?
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #11 on: June 28, 2018, 01:11:40 pm »
I think the problem is more that sometimes ArchiMate is like UML and other times it isn't, and there is no [consistent] logic to when it is and when it isn't.

Whilst I don't disagree with your statement and the follow on comments, I'm interested as to how this relates to the original request (assuming it does ?)
I see the same confusion with stock standard UML - wrt to explicit composition as opposed to implict nesting, from a model perspective

Glassboy

  • EA Practitioner
  • ***
  • Posts: 1367
  • Karma: +112/-75
    • View Profile
Re: Advice - to nest or to compose ?
« Reply #12 on: June 28, 2018, 02:27:24 pm »
Whilst I don't disagree with your statement and the follow on comments, I'm interested as to how this relates to the original request (assuming it does ?)
I see the same confusion with stock standard UML - wrt to explicit composition as opposed to implict nesting, from a model perspective

The ArchiMate specification says

Quote
Nesting elements inside other elements can be used as an alternative graphical notation to express structural relationships.
.

which is a bit more profligate than UML.  While there may be the same confusion, in my experience it's more contained and less problematic.