Intro to UML OOP Tirgul 10 2006. UML UML is a graphical representation scheme for modeling OO...

Post on 19-Dec-2015

219 views 3 download

Tags:

transcript

Intro to UML

OOP Tirgul 10

2006

UML

• UML is a graphical representation scheme for modeling OO systems

• UML today is a unification of various popular notational schemes.

UML Diagrams

• There are 13 types of UML diagrams.

• We will concentrate on two diagrams :

– Use Case Diagram – What is required – Class Diagram – How to implement what is

required

Use Case Diagram

• The purpose of a Use Case Diagram is to organize define what is required from our system to perform.

• The diagram consists of:– Users (which can be humans or other

modules of software/hardware)– Possible uses– Associations from users to uses.

Use Case ExampleAutomatic Teller Machine

• Who does the ATM interacts with ?

• What are the uses of an ATM ?

Use Case (1) – User interaction

Use Case (2) – User and bank interaction

Class Diagrams

• The purpose of a class diagram is to define the classes in the system, and the relations between them.

• The diagram consists of Classes and relation marks

Class

ATM

int _moneyLeft

List _transactions

void displayWithdrawlValues()

….

Class name

Attributes

Methods

Association Relation

At any given point in the program flow, one object of ATM participates in an association with zero or one objects of withdrawal.

The role name of the withdrawal.

Composition Relation

• Only one class is the “whole”, the class which contains the other classes.

• The parts that are included in the “whole”, can exist only if a “whole” exists

• A part may belong to one “whole” at a time.

Composition Relation

Composition is represented by a straight line with a diamond at the end. The numbers represents the number of associated objects.

Aggregation RelationA screen object can exist independently, and an ATM can be associated with more than 1 screen.

Inheritance Relation

Using an ATM which is more than 500 meters from a bank office, involves paying special commission