Book a Demo

Author Topic: update class in sequence diagrams but keep message  (Read 3802 times)

Brian Brooks

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
update class in sequence diagrams but keep message
« on: July 20, 2012, 01:52:48 am »
In EA 9.2 build 921, I have created sequence diagrams that show messages inbound to and outbound from class name Monkey.  After doing some coding, I would now like to update the sequence diagrams to replace the class Monkey with class Gorilla.  

Is there anyway to just update the class but not have to redo all the linked messages?

philchudley

  • EA User
  • **
  • Posts: 750
  • Karma: +22/-0
  • EA Consultant / Trainer - Sparx Europe
    • View Profile
Re: update class in sequence diagrams but keep mes
« Reply #1 on: July 20, 2012, 02:07:42 am »
This may work, assuming you want the same messages / operations in Monkey and Gorilla

Add the class Gorilla to a class diagram.
Select all the operations in the Class Monkey in the Project browser and drag and drop to the Class Gorilla.

Assuming that you created an object instance from your Monkey class, then right click and choose [highlight]Advanced | Instance Classifier...[/highlight] and set the classifier to your class Gorilla
Models are great!
Correct models are even greater!

Brian Brooks

  • EA Novice
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Re: update class in sequence diagrams but keep mes
« Reply #2 on: July 20, 2012, 02:21:02 am »
Thanks, Phil.

Quote
Add the class Gorilla to a class diagram.
Select all the operations in the Class Monkey in the Project browser and drag and drop to the Class Gorilla.

I'm more interested in avoiding redoing the message lines in the diagrams, so I think your second suggestion applies more than this one.

Quote
Assuming that you created an object instance from your Monkey class, then right click and choose Advanced | Instance Classifier... and set the classifier to your class Gorilla

I still get confused about why you would use a class versus an instance.  Some sequence diagrams were built with classes and others with object instances (mainly out of ignorance of the distinction).  For sequences diagram messages would I use an instance for a "Java instance method" and a class for a "Java static method"?
« Last Edit: July 20, 2012, 02:21:49 am by buzz3791 »

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +397/-301
  • I'm no guru at all
    • View Profile
Re: update class in sequence diagrams but keep mes
« Reply #3 on: July 20, 2012, 02:24:00 am »
You should always use instances since the sequence diagrams show real-world examples. And those use instances, not classes.

q.

[edit]: Helmut's point below is even more important. I remember how often we ran into trouble as we were not aware of this.
« Last Edit: July 20, 2012, 06:51:47 am by qwerty »

Helmut Ortmann

  • EA User
  • **
  • Posts: 970
  • Karma: +42/-1
    • View Profile
Re: update class in sequence diagrams but keep mes
« Reply #4 on: July 20, 2012, 04:08:27 am »
Hello,

if you use classes and Version Control you may experience data loss. There is a chapter in the documentation.

Kind regards,

Helmut
Coaching, Training, Workshop (Addins: hoTools, Search&Replace, LineStyle)