cop 4331 recitation #2

25
COP 4331 Recitation #2

Upload: shanae

Post on 22-Feb-2016

59 views

Category:

Documents


0 download

DESCRIPTION

COP 4331 Recitation #2. COP 4331 Recitation #2. Kia Manoochehri [email protected] Office Hours: 1:30-3:30 Tuesday / Thursday HEC 308 (The Cave). Unified Modeling Language. Class & Sequence Diagrams. Class Diagram. Each class is divided into three components:. Class Diagram. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: COP 4331 Recitation #2

COP 4331 Recitation #2

Page 2: COP 4331 Recitation #2

Kia Manoochehri◦ [email protected]

Office Hours: 1:30-3:30 Tuesday / Thursday◦ HEC 308 (The Cave)

COP 4331 Recitation #2

Page 3: COP 4331 Recitation #2

Unified Modeling Language

Class & Sequence Diagrams

Page 4: COP 4331 Recitation #2

Each class is divided into three components:

Class Diagram

Page 5: COP 4331 Recitation #2

Each class is divided into three components:

Class Diagram

Class Name

Page 6: COP 4331 Recitation #2

Each class is divided into three components:

Class Diagram

Class Name

Attributes

Page 7: COP 4331 Recitation #2

Each class is divided into three components:

Class Diagram

Class Name

Attributes

Attributes can be:+ Public- Private# Protected

Page 8: COP 4331 Recitation #2

Each class is divided into three components:

Class Diagram

Class Name

Attributes

Operations

Page 9: COP 4331 Recitation #2

Class Diagram example:

Page 10: COP 4331 Recitation #2

Class Diagram example: Patron

Page 11: COP 4331 Recitation #2

Class Diagram example: Patron

# ID_Number : integer+Name : String- Fines : double

Page 12: COP 4331 Recitation #2

Class Diagram example: Patron

# ID_Number : integer+Name : String- Fines : double

checkFines()payFines()

Page 13: COP 4331 Recitation #2

Class diagrams also contain information regarding the relationship between them◦ Association

◦ Dependency

◦ Generalization

Class Diagram

Page 14: COP 4331 Recitation #2

Association: A link indicating that two classes need to communicate with one another

Class Diagram

Student Professor

Page 15: COP 4331 Recitation #2

Association: A link indicating that two classes need to communicate with one another◦ Multiplicity: Every professor has 1 or more

students

Class Diagram

Student Professor[1…*]

Page 16: COP 4331 Recitation #2

Association: A link indicating that two classes need to communicate with one another◦ Multiplicity: Every professor has 1 or more

students

◦ Role Names: Students learn from Professors

Class Diagram

Student Professorlearns fromteaches

Page 17: COP 4331 Recitation #2

Aggregation: “has a” association. Each part exists outside of the whole

Shown by using an empty diamond

Class Diagram

Car

Wheel

Engine

Page 18: COP 4331 Recitation #2

Composition: demonstrates strong ownership, the part cannot exist without the whole and vice versa

Shown by using a filled diamond

Class Diagram

Person

Arm

Leg

Page 19: COP 4331 Recitation #2

Dependency relationship: ◦ Is a semantic relationship between classes

because the functionality of one depends on the other

Class Diagram

Calendar

addEvent(p: Party)

Party

Page 20: COP 4331 Recitation #2

Generalization: connection between a subclass and a superclass

Class Diagram

People

Student Professor

Page 21: COP 4331 Recitation #2

Sequence diagrams emphasis the time ordering of messages

Sequence Diagram

Page 22: COP 4331 Recitation #2

Sequence diagrams emphasis the time ordering of messages◦ Objects create the “object life line”

Sequence Diagram

Page 23: COP 4331 Recitation #2

Messages are shown by a horizontal line between life lines◦ May include a condition

Sequence Diagram

Customer Bank

withdraw money

Page 24: COP 4331 Recitation #2

A return message is a response from the object

Sequence Diagram

Customer Bank

withdraw money

money

Page 25: COP 4331 Recitation #2

The end of an object life line is demonstrated by an X

Sequence Diagram

Bank