13 August 2019

Astah Productivity: How to quickly create UML Classes from Objects in UML Sequence Diagram

I usually begin modelling from a UML Sequence Diagram in order to have a sensing of a list of classes/ objects. However, the downside with starting with the Sequence Diagram is that the classes are not created automatically.

Other than having to manually create classes to link to the object (lifeline) which is rather tedious, I finally found a great (undocumented?) feature in Astah that allows me to create a class (automatically) from an object (lifeline) in the Sequence Diagram!

BEFORE: the usual steps to creating classes from Sequence Diagrams.

  • Create lifelines and messages as required

  • For lifeline objects that need to be created as a Class, click on the object. The properties panel should show the base class as <<Unspecified>>

  • As the class has not been previously created, we need to create a new Class (usually) with the same name as the object. Click on New and rename the Class

  • Press close on the dialog box. The lifeline object is now an instance of the new class

  • Remove the original lifeline object name (if required)

  • Repeat for each lifeline object

AFTER: a much better way to do things! 

  • Create lifelines and messages as required
  • For lifeline objects that need to be created as a Class, click on the object

  • Rename the object with a preceding colon (to denote that the object is an instance of a Class)

  • A prompt pops up "Do you want to create a new <<Name_Of_Class>> for the type?". Choose "Yes"

  • A new class is created with the name and the original lifeline object name automatically disappears.

  • Repeat for each lifeline object



No comments: