1. UML and OO
System design
2010 Autumn
Morten Bo Nielsen
Mon@eal.dk
2. UML and OO
● What is UML?
● Who defines it?
● What does “object oriented” mean?
● What is an object?
● What is a class?
● Why use objects?
System design - Mon@eal.dk 2
3. UML
● UML is all about modelling
● And communicating ideas
● Collection of diagrams
● Functional modelling: Use case diagrams
● Structural modelling: Class diagrams
● Behavioural modelling: State machine, sequence
diagrams, communication diagrams.
● A lot more exists
example project
System design - Mon@eal.dk 3
5. OOP words
● Class, Object, Instance, Method/Properties,
(Message passing), Inheritance, Abstraction,
Encapsulation, Decoupling, Polymorphism
System design - Mon@eal.dk 5
6. Why classes?
● Encapsulation
● Code reuse
● Use standardized patterns
● Abstraction
● Modularisation of the code
Note that much of this is
possible without OOP
System design - Mon@eal.dk 6
7. Software example
- IP addresses
Class
Objects
IpAddress* IpAddressOfPc1
= new IpAddress( 192.168.1.100, 255.255.255.0 );
IpAddress* IpAddressOfPc2
= new IpAddress( 192.168.1.101, 255.255.255.0 );
System design - Mon@eal.dk 7
8. Physical world - Books
Class
“Book” covers everything we would call a “book”
Which to use
depends on context
Objects
1. Books as defined by ISBN
2. Books as in “every book is unique”
My copy is different from yours
8 SD3 - mon@sde.dk 25-10-2009
System design - Mon@eal.dk 8
9. Inheritance design problem
Book type is most Book content is most
impor tant impor tant
Book Book
System Analysis and Design
Paperback Hardcover
with UML version 2.0
book book
by A. Dennis et al.
ISBN: 978-0-471- Paperback Hardcover
65920-4 book book
System design - Mon@eal.dk 9
10. UML use case diagrams
● User ← admin actors example.
System design - Mon@eal.dk 10