l3-5d-s1 class diagrams © m.e. fayad 2000 -- 2005 sjsu -- cmpe software system engineering dr. m.e....

18
© M.E. Fayad 2000 -- 2005 SJSU -- CmpE L3-5d-S1 Class Diagrams Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room #283I College of Engineering San José State University One Washington Square San José, CA 95192-0180 http://www.engr.sjsu.edu/~fayad

Post on 20-Dec-2015

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU -- CmpE L3-5d-S1 Class Diagrams

Software System Engineering

Dr. M.E. Fayad, Professor

Computer Engineering Department, Room #283I

College of Engineering

San José State University

One Washington Square

San José, CA 95192-0180

http://www.engr.sjsu.edu/~fayad

Page 2: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S2 Class Diagrams

2

Lesson 17:Class Diagrams

Page 3: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S3 Class Diagrams

Lesson Objectives

Objectives

3

Understand How to put together a class diagram Explore sample of classes and relationships Explore classes and association’s notation Understand the guidelines for putting together a class diagram

Page 4: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S4 Class Diagrams

The most common diagram found in

modeling object-oriented system

Model the static design view of a system

The foundation for

– component diagrams

– deployment diagrams

4

Class Diagrams (1)

Page 5: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S5 Class Diagrams

Class diagrams commonly contain the

following– classes

– interfaces

– collaborations

– dependency, generalization, and association relationship

– notes and constraints 5

Class Diagrams (2)

Page 6: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S6 Class Diagrams

Captures the vocabulary of a system

Built and refined throughout development

Purpose– To model the vocabulary of a system

– To model simple collaborations

– To model a logical database scheme

6

Class Diagram

Page 7: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S7 Class Diagrams

11

Symbols for Class And Association

Page 8: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S8 Class Diagrams

8

Class and Association’s Notation

Page 9: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S9 Class Diagrams

9

Class Diagram: Example (1)

Page 10: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S10 Class Diagrams

10

Class Diagram: Example (2)

Page 11: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S11 Class Diagrams

Class Diagram: Example (3)

Page 12: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S12 Class Diagrams

12

Class Diagram: Example (4)

Page 13: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S13 Class Diagrams

13

Class Diagram: Example (5)

Page 14: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S14 Class Diagrams

14

Class Diagram: Example (6)

Page 15: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S15 Class Diagrams

15

Class Diagram: Example (7)

Page 16: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S16 Class Diagrams

16

Class Diagram: Example (8)

Page 17: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S17 Class Diagrams

A well-structured class diagram– is focused on communicating one aspect of a

system’s static design view

– contains only elements that are essential to understanding that aspect

– provides detail consistent with its level of abstraction

– is not so minimalist that it misinforms the reader about important semantics

17

Guidelines

Page 18: L3-5d-S1 Class Diagrams © M.E. Fayad 2000 -- 2005 SJSU -- CmpE Software System Engineering Dr. M.E. Fayad, Professor Computer Engineering Department, Room

© M.E. Fayad 2000 -- 2005 SJSU – CmpE --- M.E. Fayad L3-5d-S18 Class Diagrams

T/F

1. Multiplicity defines how many instances of one class can be associated with the instance of the other class.

2. Bi-directional - The fact that associations are read in both directions

3. For one to one there are three possibilities: A 0..1 0..1 B A 0..1 1..1 B A 1..1 1..1 B

4. Multiplicity is the number of associations of instances of each class.

5. Class diagrams model the dynamic design view of a system. 18

Discussion Questions