[go: up one dir, main page]

0% found this document useful (0 votes)
48 views18 pages

The Unified Modeling Language (UML) Class Diagrams

The document discusses the Unified Modeling Language (UML) and class diagrams. It describes UML as a standardized modeling language used to conceptualize and design software systems. It focuses on class diagrams, which illustrate classes, attributes, methods, and relationships. The key relationships discussed are association, aggregation, composition, and inheritance.

Uploaded by

Arslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
48 views18 pages

The Unified Modeling Language (UML) Class Diagrams

The document discusses the Unified Modeling Language (UML) and class diagrams. It describes UML as a standardized modeling language used to conceptualize and design software systems. It focuses on class diagrams, which illustrate classes, attributes, methods, and relationships. The key relationships discussed are association, aggregation, composition, and inheritance.

Uploaded by

Arslan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

The Unified Modeling Language

(UML)

Class Diagrams
Unified Modeling Language
• A standardized modeling language for the
conceptualization and design of software
systems
• Two types of diagrams: structure diagram and
behavior diagram
• There are a lot of diagram types in the UML
(14 types!) but we will focus only on a few in
this class
Common Structure Diagrams
• Class Diagram
– Illustrates classes, with attributes and methods, along with their
relationships
– We will focus primarily on class diagrams, since they are by far
the most commonly used
• Component Diagram
– Illustrates how components (each with an API or similar
connecting interface) interfaces with other components
• Object Diagram
– Illustrates the objects instantiated in a system at a single point in
time
• Package Diagram
– Illustrates the packages in a system and their dependencies
Common Behavior Diagrams
• Activity Diagram
– A “flow chart” of sorts
• Interaction Diagram
– The message sequence chart is one type of
interaction diagram
• Use Case Diagram
– Represents Actors and their respective use-cases
• State Machine Diagram
– Displays states and transitions
Class

Class/Object Name

Attributes

Methods/Operations

A class name should be descriptive (Italic if abstract)


The attributes of a class defines its properties, what data the class stores
The methods/operations of a class specify what the class does
Visibility of Attributes and Methods
Association
Relationship where all object have their own
lifecycle and there is no owner.
Ex: Airplane and passengers.
No ownership between the objects and both
have their own lifecycle. Both can create and
delete independently
Aggregation
Special form of Association where all object have
their own lifecycle but there is ownership ( Has a
relationship(weak ownership) and child object can
not belongs to another parent object.
Ex: Department and teacher.

A single teacher can not belongs to multiple departments, but

if we delete the department teacher object will not destroy.


Composition

Special form of Aggregation . Child object dose not


have their lifecycle and if parent object deletes, all
child object will also be deleted (strong ownership).
Ex : Person and hands.
Generalization/Specialization
Generalization: Specialization:
“a parent” “a child”, inherits from a
general class
Realization (Implementation)
• Relationship where one class (the client)
implements another (the supplier)
• Represented with a dashed line from the
implemented class to the implementation
Examples of relationShips
Inheritance : ”is” relationship

An employee is a person
Association

5..60 Take 0..3 Teach


1
Student * Course Teacher
Faculty

public class Student { public class Course { public class Faculty {


/** Data fields */ /** Data fields */ /** Data fields */
private Course[] private Student[] private Course[]
courseList; classList; courseList;
private Faculty faculty;
/** Constructors */ /** Constructors */
/** Methods */ /** Constructors */ /** Methods */
} /** Methods */ }
}

An association is usually represented as a data field in the class.

14
Representing Aggregation/composition in Classes
Composition Aggregation

Name Person Address

public class Name { public class Person { public class Address {


/** Data fields */ /** Data fields */ /** Data fields */
/** Constructors */ private Name name; /** Constructors */
/** Methods */ private Address address; /** Methods */
} }
/** Constructors */
/** Methods */
}

An aggregation / composition relationship is usually represented as a data field in the aggregated class.

15
Inheritance
Inheritance models the is-an-extension-of
relationship between two classes.

public class Faculty extends Person {


/** Data fields */
Person Faculty
/** Constructors */
/** Methods */
}
(A) (B)

16
Class diagram of Point of sale system
• Association
No ownership
Own lifecycle
• Aggregation
Ownership ( has a..)
Own lifecycle
• Composition
Ownership (composed of ..)
 No Own lifecycle
• Inheritance
Is relationship

You might also like