Class Diagrams

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 21

UML - Class Diagrams

What is UML Diagram?


• Unified Modeling Language (UML)
• Standardized general-purpose modeling language
in the field of object-oriented software
engineering.
• The standard is managed, and was created, by the
Object Management Group.
UML Diagram
• UML 2.2 has 14 types of diagrams
divided into two categories.
• Seven diagram types represent
structural information.
• Seven represent general types of
behavior.
UML Diagram Types
What is class diagram?
• Is a type of static structure diagram that
describes the structure of a system by showing
the system's classes, their attributes,
operations (or methods), and the relationships
among the classes.
CONT….

Class diagram describes the attributes and


operations of a class and also the constraints
imposed on the system.
The class diagrams are widely used in the
modeling of object-oriented systems because
they are the only UML diagrams, which can
be mapped directly with object-oriented
languages.
Class Diagram Models

Class Name

Attributes

Methods
The purpose of the class diagram can
be summarized as −

• Analysis and design of the static view of


an application.
• Describe responsibilities of a system.
• Base for component and deployment
diagrams.
• Forward and reverse engineering.
What are the uses of class diagram?

1. Class diagrams are the blueprints of your


system or subsystem. You can use class
diagrams to model the objects that make
up the system, to display the relationships
between the objects, and to describe what
those objects do and the services that
they provide
CONT….

2. You can use class diagrams to visualize,


specify, and document structural features in
your models
3. During the implementation phase of a
software development cycle, you can use
class diagrams to convert your models into
code and to convert your code into models.
Where to Use Class Diagrams?

• Generally, UML diagrams are not directly


mapped with any object-oriented programming
languages but the class diagram is an
exception.
• Class diagram clearly shows the mapping with
object-oriented languages such as Java, C++,
etc. From practical experience, class diagram
is generally used for construction purpose.
CONT….

In a nutshell it can be said, class diagrams are used for −


• Describing the static view of the system.
• Showing the collaboration among the
elements of the static view.
• Describing the functionalities performed by
the system.
• Construction of software applications using
object oriented languages.
Benefits of class diagrams

Class diagrams offer a number of benefits for any


organization. Use UML class diagrams to:
1. Illustrate data models for information
systems, no matter how simple or
complex.
2. Better understand the general overview of
the schematics of an application.
3. Visually express any specific needs of a
system and disseminate that information
throughout the business.
CONT…..

4. Create detailed charts that highlight any


specific code needed to be programmed and
implemented to the described structure.
5. Provide an implementation-independent
description of types used in a system that are
later passed between its components.
How to Draw a Class Diagram?

Class diagrams are the most popular UML


diagrams used for construction of software
applications. It is very important to learn the
drawing procedure of class diagram.
CONT….

Class diagrams have a lot of properties to


consider while drawing but here the diagram
will be considered from a top level view.
Class diagram is basically a graphical
representation of the static view of the system
and represents different aspects of the
application. A collection of class diagrams
represent the whole system.
The following points should be remembered
while drawing a class diagram −

•The name of the class diagram should be


meaningful to describe the aspect of the system.
•Each element and their relationships should be
identified in advance.
•Responsibility (attributes and methods) of each
class should be clearly identified
CONT….
•For each class, minimum number of properties
should be specified, as unnecessary properties
will make the diagram complicated.
•Use notes whenever required to describe some
aspect of the diagram. At the end of the drawing
it should be understandable to the developer/coder.
•Finally, before making the final version, the
diagram should be drawn on plain paper and
reworked as many times as possible to make it
correct.
The following diagram is an example of an Order System of an
application. It describes a particular aspect of the entire
application.
• First of all, Order and Customer are identified
as the two elements of the system. They have a
one-to-many relationship because a customer
can have multiple orders.
• Order class is an abstract class and it has two
concrete classes (inheritance relationship)
Special-order and Normal Order.
• The two inherited classes have all the
properties as the Order class. In addition, they
have additional functions like dispatch () and
receive ().
The following class diagram has been drawn
considering all the points mentioned above.
THANKS

You might also like