se_lec 07_uml class diagram

31
1

Upload: amr-e-mohamed

Post on 13-Jan-2017

74 views

Category:

Software


0 download

TRANSCRIPT

Page 1: SE_Lec 07_UML CLASS DIAGRAM

1

Page 2: SE_Lec 07_UML CLASS DIAGRAM

2

The class diagram is a static model that shows the

classes and the relationships among classes in the

system.

Class diagrams illustrates classes, interfaces, and their

associations. They are used for static object modeling.

A Class diagram gives an overview of a system by

showing its classes and the relationships among them.

Class diagrams display what interacts but not what

happens when they do interact

Page 3: SE_Lec 07_UML CLASS DIAGRAM

3

The main building block of a class diagram is the class,

which stores and manages information in the system.

A blueprint that an object made from.

The class contains two major parts:

• Attributes “data members”.

• Operations “method members”.

Page 4: SE_Lec 07_UML CLASS DIAGRAM

4

No arrows; info can

flow in both directions

Aggregation – Order class

contains OrderDetail classes.

Could be composition?

Page 5: SE_Lec 07_UML CLASS DIAGRAM

5

Page 6: SE_Lec 07_UML CLASS DIAGRAM

6

Page 7: SE_Lec 07_UML CLASS DIAGRAM

7

Page 8: SE_Lec 07_UML CLASS DIAGRAM

8

Page 9: SE_Lec 07_UML CLASS DIAGRAM

9

Class diagrams are great for:

discovering related data and attributes

getting a quick picture of the important entities in a system

seeing whether you have too few/many classes

seeing whether the relationships between objects are too

complex, too many in number, simple enough, etc.

spotting dependencies between one class/object and another

Not so great for:

discovering algorithmic (not data-driven) behavior

finding the flow of steps for objects to solve a given problem

understanding the app's overall control flow (event-driven? web-

based? sequential? etc.)

Page 10: SE_Lec 07_UML CLASS DIAGRAM

10

Page 11: SE_Lec 07_UML CLASS DIAGRAM

11

Draw a class diagram for a information modeling systemfor a school.

School has one or more Departments.

Department offers one or more Subjects.

A particular subject will be offered by only onedepartment.

Department has instructors and instructors can workfor one or more departments.

Student can enrol in upto 5 subjects in a School.

Instructors can teach upto 3 subjects.

The same subject can be taught by differentinstructors.

Students can be enrolled in more than one school.

Page 12: SE_Lec 07_UML CLASS DIAGRAM

12

School has one or more Departments.

School Departmenthas1 1..*

Department offers one or more Subjects.

A particular subject will be offered by only one department.

Department Subjectoffers1 1..*

Page 13: SE_Lec 07_UML CLASS DIAGRAM

13

Department has Instructors and instructors can work

for one or more departments.

assigned to1..*

Instructor Department1..*

Student can enrol in upto 5 Subjects.

Student Subjecttakes* 0..5

Page 14: SE_Lec 07_UML CLASS DIAGRAM

14

Instructors can teach up to 3 subjects.

The same subject can be taught by different

instructors.

Instructor Subjectsteaches

1..*

1..3

Page 15: SE_Lec 07_UML CLASS DIAGRAM

15

Students can be enrolled in more than one school.

Student Schoolmember

*

1..*

Page 16: SE_Lec 07_UML CLASS DIAGRAM

16

School Department

Student Subject Instructor

1…*

*

member

* 1..5

attends

1..3 1..*

teaches

1..*

1

1 1..*

has

1..*

1..*

assignedTo

offeres

Page 17: SE_Lec 07_UML CLASS DIAGRAM

17

Object Diagram shows the relationship between objects.

Unlike classes objects have a state.

Page 18: SE_Lec 07_UML CLASS DIAGRAM

18

c1: Company

d2: Departmentd1: Department

name=“Sales” name=”CSSE”

p1: Persont

name=“Rao”

p2: Person

name=“Raj”

manager employee

c1: Company

name=“UniMelb”

Page 19: SE_Lec 07_UML CLASS DIAGRAM

19

Page 20: SE_Lec 07_UML CLASS DIAGRAM

20

Page 21: SE_Lec 07_UML CLASS DIAGRAM

21

Page 22: SE_Lec 07_UML CLASS DIAGRAM

22

Page 23: SE_Lec 07_UML CLASS DIAGRAM

23

Page 24: SE_Lec 07_UML CLASS DIAGRAM

24

Page 25: SE_Lec 07_UML CLASS DIAGRAM

25

Page 26: SE_Lec 07_UML CLASS DIAGRAM

26

Page 27: SE_Lec 07_UML CLASS DIAGRAM

27

Page 28: SE_Lec 07_UML CLASS DIAGRAM

28

Page 29: SE_Lec 07_UML CLASS DIAGRAM

29

Page 30: SE_Lec 07_UML CLASS DIAGRAM

30

Page 31: SE_Lec 07_UML CLASS DIAGRAM

31