Date post: | 20-Jan-2018 |
Category: |
Documents |
Upload: | stephen-bishop |
View: | 213 times |
Download: | 0 times |
A means of graphically displaying a complicated programs
May 14, 2023
UML
Thanks to Dave Matuczek, UPenn
What is UML?
2
UML stands for Unified Modeling Language or Universal Modeling Language
UML uses graphics to show the relationships between program classes and objects.
Design Patterns
3
Design Patterns common programming strategies
Design Patterns are best described by UMLWe will learn some simple patterns in class
Variables
5
A variable is written as: domain name : typewhere:+ means public - means private
Example: +length:int
Variables
6
Static variables are underlinedAn initial value can be shown with =valueExample:
-numberOfEmployees:int=10
means numberOfEmployees is:privatestaticintegerand has 10 as its initial value
Methods
7
Methods are written as: domain name (parameters) : returnTypewhereDomain uses the same syntax variables (+, -,
blank)parameters are given as name:typeif the returnType is void, it is omittedconstructors are preceded by «constructor»interfaces are preceded by «interface»
Example of a class
8
Card
+cardId:int-copy:boolean=false
«constructor» Card( int id )+isKind( desiredKind:int )+isSharable( ):boolean+toString( ):String
Types of relationships
9
A
B
class Bextendsclass A
C
D1..4
“Is a” “Has a”
Class Ccontains
1 to 4 objectsof class D
IGeometry
Cube
Implements
Composition"has a"object instantiation
public BankAccountClass myAccount;myAccount = new
BankAccountClass( ….