Book a Demo

Author Topic: Object vs Sequence Instance  (Read 6244 times)

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Object vs Sequence Instance
« on: May 08, 2008, 06:03:35 pm »
If you Ctrl drag a class onto a sequence diagram and ensure:
(o) as Instance of Element (Object) radio button is marked, you get an object with a lifeline.

If you accidentally (because of EAUI) drop the Class onto the diagram, I would have thought that <Element Context Menu>|Advanced>Convert to Instance would convert it to an Object.

But it doesn't, it converts it to a Sequence Instance.

Can someone explain what the difference is? (Since I couldn't find any explanation in the User Guide)

And why you can't convert the Sequence Instance to an Object via Element|Change Type...

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

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Object vs Sequence Instance
« Reply #1 on: May 13, 2008, 11:05:53 am »
Bump...

Can any Sparxians elighten us?  Anyone else?

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

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Object vs Sequence Instance
« Reply #2 on: May 14, 2008, 04:41:06 pm »
No idea what an instance of a lifeline referring to a class would be good for (as opposed to a lifeline referring to an instance of a  class). Come to that, what could we possibly do with an instance of a lifeline referring to an instance of a class? Maybe one of those who have actually read the superstructure can shed some light.

As to the behaviour: probably only Sparx can tell why the type cannot be changed. Or why there are elements at all whose type cannot be changed.

I would see this as a bug. Or at least as an inconsistency which Sparx should at least comment (or better still fix).

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Object vs Sequence Instance
« Reply #3 on: May 27, 2008, 07:13:29 pm »
 Bump...

Sparxian Roy (or ANY Sparxian) - can you explain what the difference is between a Sequence Instance and an Object on a Sequence diagram?

This is NOT a rhetorical question... I really wanty to know!

We (our company) need to decide whether we need two types of elements here or just one...  

I couldn't find any reference to a sequence instance in the UML 2.1.2 Superstructure (formal) Specification.

TIA,
Paolo
« Last Edit: May 27, 2008, 07:16:20 pm by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!

johnm9

  • EA User
  • **
  • Posts: 52
  • Karma: +0/-0
    • View Profile
Re: Object vs Sequence Instance
« Reply #4 on: May 27, 2008, 08:10:55 pm »
There are two types of sequence diagram. One is generic sequence diagram and one is instance level sequence diagram.

A generic sequence diagram can include more than one possible path. For example, when u use "alt" or guard to disdinguish two possible path in your sequence diagram, you are describing a generic case although you are having an object instance on top of the lifeline.

An instance level sequence diagram is really describing a single communication pattern that happens in runtime. this is a sequence instance.

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Object vs Sequence Instance
« Reply #5 on: May 28, 2008, 05:42:17 am »
Quote
There are two types of sequence diagram. One is generic sequence diagram and one is instance level sequence diagram.

OK, so when you want to describe the generic behaviour of classes you use lifelines based on classes. And to describe the behaviour of instances of classes (perhaps even of various instances of the same class) you use lifelines based on objects. Makes perfect sence, and seems to cover everything you would use a sequence diagram for.

But what are instances of lifelines for? Could it be that Sparx simply forgot to disable the creation of instances for lifelines, and as a consequence didn't handle them (resulting e.g. in the phenomenon that their type cannot be changed)?

There are things in EA for which no instances can be created. In an activity diagram, you can create instances of activities, but no instances of actions. Drag an action from the project browser to a diagram with ctrl pressed, and you will get the usual dialog, but if you choose the "as instance" option EA will simply ignore it.

EA doesn't seem to say which element support instances; it only says

Quote
Elements that are classifiers and support instances of themselves at runtime can be dropped either as a link to the classifier itself, or as a new instance of the classifier.

Eve

  • EA Administrator
  • EA Guru
  • *****
  • Posts: 8110
  • Karma: +119/-20
    • View Profile
Re: Object vs Sequence Instance
« Reply #6 on: May 28, 2008, 07:53:38 am »
Quote
EA doesn't seem to say which element support instances; it only says

Quote
Elements that are classifiers and support instances of themselves at runtime can be dropped either as a link to the classifier itself, or as a new instance of the classifier.
Perhaps that description could be clearer, but if you look at the UML specification only some metatypes inherit from the classifier type, and instances of the classifier type can have instances of them.
« Last Edit: May 28, 2008, 07:54:43 am by simonm »

Frank Horn

  • EA User
  • **
  • Posts: 535
  • Karma: +1/-0
    • View Profile
Re: Object vs Sequence Instance
« Reply #7 on: May 28, 2008, 04:57:41 pm »
Quote
if you look at the UML specification only some metatypes inherit from the classifier type, and instances of the classifier type can have instances of them.

So does the lifeline metatype inherit from the classifier type? I think it only inherits from NamedElement, but I could be mistaken (didn't read all 732 pages).

Anyway, to put Paolo's original question in these terms:

If lifeline inherits from classifier, what is a lifeline instance there for? And why does EA not allow to change it's type once it has been created?

Or, if lifeline does not inherit from classifier, why does EA allow instances of lifelines to be created?

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Object vs Sequence Instance
« Reply #8 on: May 28, 2008, 09:51:58 pm »
Quote
There are two types of sequence diagram. One is generic sequence diagram and one is instance level sequence diagram.

A generic sequence diagram can include more than one possible path. For example, when u use "alt" or guard to distinguish two possible path in your sequence diagram, you are describing a generic case although you are having an object instance on top of the lifeline.

An instance level sequence diagram is really describing a single communication pattern that happens in run time. this is a sequence instance.
I would have said there are three types of sequence diagrams:
1) A scenario based diagram that traced the execution of a particular scenario (with objects having specific states and data values).  This is what is traced by EA's debugger attachment yes?  I've never done it myself yet - but that's my understanding.  In this diagram, specific objects in the code and specific values of parameters are traced.  The lifelines are object based.
2) A generic diagram based on the aggregation of a number of possible scenarios.  This would have <alt>s and other higher level structures but still be object lifeline based.  I suspect (without proof) that you could construct such a diagram by static analysis of the code.
3) A generic diagram based on class lifelines that expresses some higher level aggregation of possible messages.  This type of diagram might be used in an analysis phase.

Since I can find no evidence of a "sequence instance" element in the UML superstructure, I'm at a loss to understand the effective difference between an object (with run state) and EA's sequence instance.

My original questions still stand - supplemented by Frank Horn's redux.

I'm at a loss as to why a Sparxian can't "put this to bed".   :(

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

KP

  • EA Administrator
  • EA Expert
  • *****
  • Posts: 2919
  • Karma: +55/-3
    • View Profile
Re: Object vs Sequence Instance
« Reply #9 on: May 30, 2008, 11:08:40 am »
Quote
If you Ctrl drag a class onto a sequence diagram and ensure:
(o) as Instance of Element (Object) radio button is marked, you get an object with a lifeline.

If you accidentally (because of EAUI) drop the Class onto the diagram, I would have thought that <Element Context Menu>|Advanced>Convert to Instance would convert it to an Object.

But it doesn't, it converts it to a Sequence Instance.
I think that's incorrect behaviour - it should create an Object instance. Could you send in a bug report please?

Quote
Can someone explain what the difference is? (Since I couldn't find any explanation in the User Guide)
I think it's a UML 1 hangover. An Object lifeline (created by Ctrl+dragging a class from the project browser) and a Sequence lifeline (created by dropping a "Lifeline" element from the Interaction toolbox) represent the same thing, but I'd recommend using Object lifelines because they can be re-used on other diagram types, e.g. on communication diagrams where sequence lifelines render badly.

Quote
And why you can't convert the Sequence Instance to an Object via Element|Change Type...
My guess is the command was blocked for a specific reason that probably no longer applies. Can you add that to the bug report please?

Thanks.
The Sparx Team
[email protected]

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Object vs Sequence Instance
« Reply #10 on: June 10, 2008, 11:06:23 am »
Quote
Done, sorry for the delay in doing so...  (also the failure to convert)
Quote
I think it's a UML 1 hangover. An Object lifeline (created by Ctrl+dragging a class from the project browser) and a Sequence lifeline (created by dropping a "Lifeline" element from the Interaction toolbox) represent the same thing, but I'd recommend using Object lifelines because they can be re-used on other diagram types, e.g. on communication diagrams where sequence lifelines render badly.
Quote
Does this mean we should change the type directly (to object)?

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