Class diagram

yadavpraneeth 816 views 13 slides Aug 25, 2015
Slide 1
Slide 1 of 13
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13

About This Presentation

Class diagram


Slide Content

Class Diagram
Presented by
M Praneeth Kumar
Ist Year M.Sc., ICT-ARD
On
14.10.2014

Introduction
•A class diagram in the Unified Modelling language (UML) is a type of static
structure diagram that describes the structure of a system by showing
•system's classes,
• their attributes,
•operations (or methods), and
•the relationships among objects.

Class
•A class is a description of a set of objects that share the same
attributes, operations, relationships, and semantics.
•Graphically, a class is rendered as a rectangle, usually
including its name, attributes, and operations in
separate, designated compartments.

Example
Bank Account
Owner : String
Balance : Dollars = 0
Deposit (Amount : Dollars)
Withdrawal (Amount : Dollars)

Class Names
•The name of the class is the only required
tag in the graphical representation of a class.
• It always appears in the top-most
compartment.
Class Name
Attributes
Operations

Class Attributes
•An attribute is a named property of a
class that describes the object being modeled.
•In the class diagram, attributes appear in
the second compartment just below the
name-compartment.
Person
Name: String
Address: Address
Birth date : Date
SSN : ID

Class Attributes (Cont’d)
Attributes can be:
• + public
• # protected
• - private
• / derived
Person
+Name: String
#Address: Address
#Birth date : Date
/ Age : Date
-SSN : ID

Class Operations
•Operations describe the class behavior and appear in the third compartment.
Person
Name: String
Address: Address
Birth date : Date
SSN : ID
Eat
Sleep
Work
Play

Relationships between Classes
•In a class diagram, it is important to see the relationship between classes.
There are following types of relationships amongst classes
•Association
•Aggregation
•Generalization

Association Relationship
•An Association is a connection between classes, showing how one class relates to another.
•The association is shown as a line drawn between the classes.
• An Association Name can be given to the association to clarify the association between two
classes
An association relationship between two classes with role
names

Aggregation Relationship
•Aggregation is a special case of association used to model a “Whole to its Parts”
relationship.
•An Aggregate relationship can be thought of as a "Consists Of" relationship, where
the Whole consists of the Parts
Basic Aggregation relationship between class Car and class Wheel

Generalization Relationship
•The Generalization relationship indicates that one of the two related classes (the
subclass) is considered to be a specialized form of the other (the super type) and
super class is considered as 'Generalization' of subclass.
•In practice, this means that any instance of the subtype is also an instance of the
super class.
Class diagram showing generalization between one super class and two subclasses
Tags