UML Structural Models Flashcards
When is modelling in software development relevant?
Throughout the entire development process.
Analysis
System design
Detailed design
Implementation
Quality Assurance
Maintenance
What are the three structural diagrams we have discussed in class?
Class diagrams, object diagrams, deployment diagrams
Class diagram:
How to draw class
Rectangle with name.
Three sections:
name, attributes, methods
Class diagram:
Attribute
In second section.
<Visibility> <name> : <type>
</type></name></Visibility>
Class diagram:
Method
In third section.
<Visibility> <name>() : <type>
<Visibility> <name>(<parameters>) : <type>
Parameter: <name> : <type>
</type></name></type></parameters></name></Visibility></type></name></Visibility>
Class diagram:
Visibility modifiers
Private -
Public +
Protected #
Class diagram:
Class members
Underlined
Same value/declaration for all objects of class
Static in Java
Class diagram:
Comments
Add little note with flap in right corner and dotted line to where the comment is for.
Class diagram:
Associations
Specifies that there is a reference between the involved entities.
Reference to another class’ objects
Class diagram:
Aggregation
Empty diamond arrow.
A special case of association.
The objects of the referenced class are “owned” (unlike plain association)
The aggregation implies a relationship where the child can exist independently of the parent.
Library is made up of one or more books. Diamond shape near parent class.
Class diagram:
Composition
Filled out diamond arrow.
A special case of association.
The objects of the referenced class are “owned” (unlike plain association)
A composition means that the referenced object is ‘part of’ the referencing object – manages the lifecycle of the referenced object.
That is, the contained class will be obliterated when the container class is destroyed. For example, a shoulder bag’s side pocket will also cease to exist once the shoulder bag is destroyed.
Again diamond at parent class.
Class diagram:
Abstract classes and methods
Writing in italics.
The UML Generalisation denotes inheritance similar to Java albeit with a different terminology.
Sub-class == specialisation
Super-class == generalisation
Class diagram:
Interface
Are marked by so called stereotypes.
In first section:
«interface»
<name>
Second:
nothing
Third:
<visibility> <name>() : <type>
</type></name></visibility></name>
Class diagram:
enumeration
Are marked by so called stereotypes.
Two sections.
«enumeration»
<name>
all the different categories
</name>
Protected visibility in UML vs Java
UML: visible only for class and subclasses
Java: Visible for class, subclass, and same package.