Book a Demo

Author Topic: Collaboration -> Sequence -> Class  (Read 9715 times)

Fintan

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Collaboration -> Sequence -> Class
« on: January 07, 2003, 07:48:20 am »
Hi everyone,

I am looking to move from Rose to EA, but I have run into major problems, probably due to my lack of understanding rather than EA itself.

The way that I do my UML diagrams is that first I draw a Collaboration diagram, then I draw the corresponding sequence diagram, and lastly I draw the Class diagram.

In Rose I can draw the Collaboration diagram, and when I draw the sequence diagram the messages from the appear as messages from the sequence diagram.

When I add a message to elements copied from the workspace to a sequence diagram - the "New" button is disabled.  I cannot figure out how to add a message to the class.  Can someone explain how to do this please?

For the Class diagrams I cannot figure out how to show the classes with the operations and attributes showing.  Even if I can add new messages in the sequence diagram, and I drag the class from the workspace onto the class diagram (with or without Ctrl+K) the operations do not show on the class diagram.  Can somebody tell me how this works please?

Many thanks,

Fintan Conway

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #1 on: January 07, 2003, 10:12:07 am »
Hi Fintan,

I hope that the contents of the following thread can help you:

http://www.sparxsystems.com.au/cgi-bin/yabb/YaBB.cgi?board=general&action=display&num=1032968284

In UML (independently of the tool you are using) it is very important to differentiate between classes and instances of the classes.

Please keep us posted if this does not address what you are looking for.

Jaime Gonzalez
« Last Edit: January 07, 2003, 10:12:32 am by jaimeglz »

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #2 on: January 07, 2003, 10:21:10 am »
Hi Fintan

I don't understand everything about how you do things, but I will try to help with the rest.

If you drag instances of your classes (not the classes themselves) onto your sequence and collaboration diagrams, you'll be able to add new operations using the New button. If the class already has operations, you'll be able to select one of these as the message from the drop down list in the Message Properties dialog. You can also write just anything you like in the message name field, but then it will not have any relation to the actual operations of the class.

The way you drag instances of classes or classes themselves is to hold down the Ctrl key while dragging (depending on the Auto-instance setting).

I can think of 2 reasons why your operations are not showing on your class diagram:

1. They are not really operations of the class, because you didn't add them as operations when naming messages in the sequence diagram. They are just labels in the sequence diagram. (see above).

2. You are placing objects (instances), not classes on the class diagram. (also see above).

Hope this helps
Mikkel

Fintan

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #3 on: January 08, 2003, 02:39:21 am »
Hi,

Many thanks for your replies.

However I still cannot get the "New" message to be enabled.

I have tried the following :
1) Open a new project
(a)Create a collaboration diagram
Drag a boundary and a control object onto the diagram
Change both to be a class
Save the project
Close down and open EA
Goto collaboration diagram
Put association between the boundary and control classes
Add a message => NEW MESSAGE still disabled

(b)Create a sequence diagram
Drag the boundary and control classes onto sequence diagram - from Workspace
Check these are still classes -> OK
Drag a message from boundary to control class
=> NEW MESSAGE still disabled

2) Open a new project
(a)Create a collaboration diagram
Drag a boundary and a control object onto the diagram - from Workspace
Check both are objects
Save the project
Close down and open EA
Goto collaboration diagram
Put association between the boundary and control objects
Add a message => NEW MESSAGE still disabled

(b)Create a sequence diagram
Drag the boundary and control objects onto sequence diagram
Check these are still objects -> OK
Drag a message from boundary to control object
=> NEW MESSAGE still disabled

The difference is that 1) uses classes and 2) uses objects.

I have even tried creating new elements (both classes and objects) on the workspace tree and dragging these onto the collaboration and sequence diagrams.  Unfortunately when I try to add messages the "New" button is still disabled.

Help please,

Fintan

PS I am using EA trial version 3.50 build 586

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #4 on: January 08, 2003, 03:48:07 am »
Fintan,

there is still a misunderstanding in your use of classes and objects.

You may be aware of these points in OOAD theory, but I will point them out anyway:

A class is the descriptor for a set of objects with similar structure, behavior, and relationships.

An object represents a particular instance of a class. It has identity and attribute values. A similar notation also represents a role within a collaboration because roles have instance-like characteristics.

When you change the object type from class to object, you are not creating instances of the class. You are changing the class into an object. The class no longer exists in the model. Instead you have an object without a classifier.

Try to do it the way I describe it in my previous post, and you'll see that it works.

Mikkel

Fintan

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #5 on: January 08, 2003, 06:51:06 am »
Hi Mikkel,

I have found that if I explicitly create a class on the Workspace tree - that I can then add an instance of that class to the collaboration diagram which allows me to add new messages.  Many thanks for your pointers on this

Do I always have to have the class already created?  I would like a way to drag an object from the toolbar on the left hand side (has icons for :  object, Process, Send, Receive, etc. under 'Analysis') and be able to use the object created to set new messages for the class.  Is this possible?

Many thanks for your patience,

Fintan

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #6 on: January 08, 2003, 07:21:09 am »
Fintan,
You can use Set Object Classifier from the object context menu or Ctrl+L to set the classifier for an existing object. The resulting dialog allows you to select an existing class or create a new one.

You're welcome!  :)
Mikkel

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #7 on: January 08, 2003, 07:23:14 am »
... but I don't think the messages can be used to create new operations, though.

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #8 on: January 08, 2003, 07:36:23 am »
Hi Fintan,

With all due respect to the way you preffer to do your modelling, I would like to make the following comments:

According to the amigos (the trio that contributed most to the creation of UML), collaboration diagrams should strictly show interactions between objects (that is, between instances of classes). This should not be taken simply as dogma, but as something that makes a lot of sense: look at an interaction diagram, and you will readily see that what is interacting is not the "salesperson" class, or the "customer" class, but  particular instances of these classes. For instance, customer "A" (say, Charlie), interacts with salesperson "B" (say, Nancy).

How, then, can you create a collaboration diagram without having previously identified the classes of which these objects are instances of?

Let me suggest that you do a use case model first, and derive your classes from the scenarios in these use cases. The best way to develop scenarios is with event lists, as the following:

1. customer phones salesperson
2. customer inquires about product
[and so forth...]

The nouns in these sentences are pretty good candidates for classes, which you will better identify once you have a more or less complete use case model.

Once you have your use cases, you can do either a sequence diagram or a collaboration diagram of your scenarios, showing the interactions in your event lists. But why do both collaboration AND sequence diagrams? I would only use one or the other, but doing both is (IMHO) severely redundant: you will have two sets of diagrams depcting the same interactions, and that means that when you have to correct one you have to correct the other one as well.

I preffer to do sequences in most cases, because in sequences you can use either classes or objects, and they are a great means of discovering the classes and their respective attributes and operations. Of course, there are many circumstances where collaborations work great, and there is also a matter of prefference.

The order in which you do your diagrams will greatly help in solving the issues you have raised, and there have been a couple of threads in the UML forum that might be of interest to you.

I hope you find this helpful.

Jaime

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #9 on: January 08, 2003, 07:42:55 am »
Jaime,

I find that having both collaboration and sequence diagrams can be very helpful in understanding the interaction. However, I agree with you that it is too much effort, especially keeping both up to date.

So I await the feature that Geoff Sparks has promised me: conversion between the 2 diagram types. Each contain all the information needed to create the other, so it is entirely possible (see my post in the thread that you mentioned above to see Sparks' opinion about this feature).

Mikkel

jaimeglz

  • EA User
  • **
  • Posts: 164
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #10 on: January 08, 2003, 07:47:36 am »
Fine idea, Mikkel.


Fintan

  • EA User
  • **
  • Posts: 28
  • Karma: +0/-0
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #11 on: January 09, 2003, 01:32:24 am »
Mikkel,

Thank you very much.  I have dragged boundary and controller objects from the Analysis toolbar onto a collaboration diagram.  I then set the Classifier to create a new class (need to set the stereotype here again - not picked up from the objects stereotype ???).

Now when I create an Association between them and add a message, I CAN make a new message.  Brilliant, this is just what I wanted. ;D

I can then create a sequence diagram and drag the classes onto it.  When I add messages I can pick from the operations (new messages) added to the objects in the collaboration diagram.  However here I CANNOT add new messages.  So, if I need any extra messages in the sequence diagram I will create new operations and add these this way.

Quote
customer "A" (say, Charlie), interacts with salesperson "B" (say, Nancy)

Jaime,

Whilst I agree that a collaboration diagrams should show objects, and that classes should be identified from the use cases.  I would suggest that when you are placing a new object on your diagram ("Charlie")- this should create a new class from which the object can be instantiated ("Customer").

The way I would see this working is that placing objects for the classes that I have identified will create the class in the system.

Thanks to both of you for your help,

Fintan

mbc

  • EA User
  • **
  • Posts: 237
  • Karma: +1/-0
  • Embedded software developer
    • View Profile
Re: Collaboration -> Sequence -> Class
« Reply #12 on: January 09, 2003, 02:11:41 am »
Fintan,

if you can't use the New button in the message dialog on sequence diagrams, you are still doing the same thing wrong when dragging from the project tree (inserting classes rather than instances of classes). Refer to my first post and look up "Drop Objects from Tree" in the help file.

Mikkel