Download presentation
Presentation is loading. Please wait.
1
UML Diagramming with Astah*
Java UML Development Environment UML Diagramming with Astah* Using Astah September 19, 2018
2
Astah – First Opened Using Astah September 19, 2018
3
Create a New Project Using Astah September 19, 2018
4
Add a Diagram Choose Class Diagram Using Astah September 19, 2018
5
New Class Diagram Using Astah September 19, 2018
6
Give Diagram a Name New Name New Name New Name Type new name here
Using Astah September 19, 2018
7
Add a Class to the Diagram
New class diagram added. Give it an appropriate name. Click this button to add a class New class Then click here to place it Using Astah September 19, 2018
8
Click to work with attributes
Add Attributes Click to work with attributes Using Astah September 19, 2018
9
Add New Attribute Fill in the Name, Type, and Visibility of the Attribute Click Add to add an attribute Using Astah September 19, 2018
10
If the desired type is not in this list, just type it here.
New Attribute If the desired type is not in this list, just type it here. Using Astah September 19, 2018
11
Editing Attribute To edit the selected attribute’s features
Change these characteristics as needed Using Astah September 19, 2018
12
Add Methods to the Class
Methods are called Operations in Astah Add, Edit, or Delete Methods as Desired Using Astah September 19, 2018
13
Adding and Editing Parameters
To add or edit parameters Using Astah September 19, 2018
14
After adding the methods
Using Astah September 19, 2018
15
Add a second class After renaming new class and adding the main method
Add a class in same way as first Using Astah September 19, 2018
16
Showing Dependency Relationship
Use this button to draw a dependency relationship – also called instantiation relationship Using Astah September 19, 2018
17
Showing Dependency Relationship
Driver and Drag to Circle Result shows that CircleDriver creates and uses one or more Circle objects Using Astah September 19, 2018
18
Labeling the Dependency Line
Line is now labeled Click on the Dependency Line to Select it. Then choose the Stereotype tab and type the label you want Using Astah September 19, 2018
19
Save the diagram – extension will be .asta
Resulting Diagram May print the diagram Save the diagram – extension will be .asta Using Astah September 19, 2018
20
Class Diagram Background Color
Change background color for a selected class diagram by clicking this button and then choosing the desired color Using Astah September 19, 2018
21
Zooming Zoomed In Fit in Window Zoom In Zoom Out Using Astah
September 19, 2018
22
Adjusting Alignment and Spacing
Using Astah September 19, 2018
23
Class Relationships and UML Connectors
Instantiation, Aggregation, and Composition Using Astah September 19, 2018
24
Class Relationships An object of one class may use an object of another class to do some part of its work A Student object may use a Computer object to complete some Assignment objects A Hand object has 5 Finger objects A Ship object has one or more Propeller objects A MovieCollection may consist of many Movie objects A Doctor object has Patient objects A HumanBody has a Head A Mechanic may use a Wrench object to loosen a Nut Using Astah September 19, 2018
25
Several Types of Relationships
Instantiation – a method of an object may instantiate and use an object of another class to do a specific task but the object being used is not a fundamental part of the object using it A Carpenter uses a Nail to fasten 2 boards together A Seamstress uses a Needle and Thread A Dog gnaws on a Bone Typically, a method of one class (say A) instantiates and uses an object of another class (say B) but the object of B is not a part (attribute) of A Using Astah September 19, 2018
26
Implementing the Instantiation Relationship
Typically, this relationship is implemented in Java code with a client method in the user class, say class A, instantiating an object of the other class, say class B, and then calling one or more methods of B on that object. In UML: Instantiates and Uses Connector Class Relationships September 19, 2018
27
Sample Code Skeleton A method in class Carpenter instantiates an object of class Hammer and then uses it. Instantiation/Uses can also be implemented by passing an object of class Hammer to a method of class Carpenter and using it. Class Relationships September 19, 2018
28
Has-A Relationships If an object of one class (say A) has a component (attribute) that is an object of another class (say B), we say Class A has a “Has-A” relationship with Class B. Also called a Part-Whole Relationship A HumanBody has-a Head A Student has-a Computer A DeckOfCards has-a collection of Card objects A Car has-a Motor A ClassRoom has-a set of Chair objects A Student has-a Advisor The key point is that the object of B is an attribute of A. Using Astah September 19, 2018
29
Two Types of Has-A Relationships
In some Has-A relationships, the relationship is essential and the constructor of one class instantiates an object of the other class A Hand has Fingers A Person has a Head A Car has a Motor The Person is not a Person without its Head and the Car is not a complete Car without its Motor This type of Has-a (Part-Whole) relationship is called Composition Using Astah September 19, 2018
30
Indicates a House object has exactly one Roof object, named roof
Composition One class is partially or fully composed of objects of other classes In the diagram, class House has (or contains) one object roof of type Roof The class acting as the whole (House) maintains a reference (or references) to an object(s) of the class that is acting as the part (Roof) The difference between this and aggregation is that the part is instantiated when the whole is instantiated. The house and the roof come into existence together (in the constructor for the House) Indicates a House object has exactly one Roof object, named roof This type of arrow indicates that the roof is an integral component of the house Class Relationships September 19, 2018
31
Drag it FROM House TO Roof …
Composition in UML Select the Composition Arrow in Astah* and Drag FROM the whole (House) TO the part (Roof) Drag it FROM House TO Roof … Select this symbol … to get this Class Relationships September 19, 2018
32
The “part” is always created when the “whole” is created
Composition The “part” is always created when the “whole” is created Because the Roof/House cannot exist without the other, the House constructor creates its own Roof – and the Roof object exists as long as the House object does Class Relationships September 19, 2018
33
Aggregation Aggregation is a type of a Has-a relationship in which one object Has-a object of another class as an attribute, but that object is not essential to the existence of the other, and it is not instantiated by the constructor of the other A Student is still a Student without a Computer A ClassRoom is still a ClassRoom even if one removes its Chairs A Person is still a Person even if he/she loses his/her Coat Using Astah September 19, 2018
34
Aggregation In the aggregate relationship, one class aggregates objects of the other class In the diagram, class Room has (or contains) zero or one objects of type Chair The class Room, acting as the whole, maintains a reference (or references) to an object(s) of the class Chair that act as the part There are usually one or more methods (that may or may not ever be invoked) that instantiate one or more instances of the part Reference name This type arrow indicates the aggregation relationship Between 0 and 1 instances of a Chair Class Relationships September 19, 2018
35
Aggregation in UML In Astah*, the aggregation relationship is indicated as shown here: Select the Aggregation Symbol Use this dropdown … Tooltip helps one select the proper symbol … to get this list Class Relationships September 19, 2018
36
Arrow is the result of dragging FROM the Room class TO the Chair class
Aggregation in astah* Drag the selected arrow FROM the “whole” (Room) TO the “part” (Chair) The PART The WHOLE Arrow is the result of dragging FROM the Room class TO the Chair class Class Relationships September 19, 2018
37
Aggregation: code skeleton
The Room has an attribute reference to a Chair object Room instantiates a reference to an object of type Chair – initially null Some method in Room associates the Room object with an actual Chair with the reference named chair Note that the Room object exists (and is initialized by the Room constructor – not shown) and the Chair object that is passed to the setChair method exists separately. The Chair becomes a real part of this Room only when this method is invoked Class Relationships September 19, 2018
38
Use this connector to an enumerated data type
Enums in UML - Example Use this connector to an enumerated data type Using Astah September 19, 2018
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.