UML Class Diagram G-3-122139

13
GROUP - C UML CLASS DIAGRAM 122065 122109 122139 122141

Transcript of UML Class Diagram G-3-122139

Page 1: UML Class Diagram G-3-122139

GROUP - CUML CLASS DIAGRAM

• 122065• 122109• 122139• 122141

Page 2: UML Class Diagram G-3-122139

UML class diagram: a picture of • the classes in an OO

system • their fields and

methods• connections between

the classes that interact or inherit from each other

Not represented in a UML class diagram:

• details of how the classes interact with each other

• algorithmic details; how a particular behavior is implemented

WHAT IS A CLASS DIAGRAM?

Page 3: UML Class Diagram G-3-122139

A CLASS

Class Name

Attributes

Methods

write <<interface>> on top of interfaces' names use italics for an abstract class name

should include all fields of the object

omit trivial (get/set) methods don't omit any methods from an interfaceshould not include inherited methods

Page 4: UML Class Diagram G-3-122139

visibility:• + public• # protected• - private• ~ package (default)• / derived

ATTRIBUTES AND METHODS

•underline static attributes/methods•parameter types listed as (name: type)•omit return type on constructors and when return type is void

Attribute - balance : double = 0.00Method + distance(p1: Point, p2: Point): double

Page 5: UML Class Diagram G-3-122139

Displays • inheritance between classes• interface implementationArrow Styles• class: solid line, black arrow• abstract class: solid line, white

arrow• interface: dashed line, white

arrow

RELATIONSHIPS - GENERALIZATION

Page 6: UML Class Diagram G-3-122139

Displays a usage relationship There are three parts of an Association :• Multiplicity : How many are used• Name : what relationship the objects have• Navigability : Direction

There are three types of Associations :• Dependency • Aggregation• Composition

RELATIONSHIPS - ASSOCIATION

Customer Order

1 *

Page 7: UML Class Diagram G-3-122139

Multiplicity• One to One

• One to Many

RELATIONSHIPS - ASSOCIATION

Page 8: UML Class Diagram G-3-122139

Dependency : • A using relationship

between two classes• A change in the

specification of one class may affect the other

• But not necessarily the reverse

RELATIONSHIPS - ASSOCIATION

Dependent Employee

dependency

Page 9: UML Class Diagram G-3-122139

Aggregation : Has a - relationship

RELATIONSHIPS - ASSOCIATION

1 1

Car

aggregation

Engine

Page 10: UML Class Diagram G-3-122139

Composition: Is composed of - relationship

RELATIONSHIPS - ASSOCIATION

Page

Book

composition

* 1

Page 11: UML Class Diagram G-3-122139

• Violet (free) – http://horstmann.com/violet/

• Rational Rose – http://www.rational.com/

• Visual Paradigm UML Suite (trial)

TOOLS

Page 12: UML Class Diagram G-3-122139

• Can be used to discover related data and attributes• Gives a quick picture of the important entities• Shows whether you have too few/many classes,

whether the relationships between objects are too complex, etc.

• Spots dependencies between one class/object and another

BUT• Not data-driven• Do not display the control flow

PROS AND CONS

Page 13: UML Class Diagram G-3-122139

THANK YOU