How to Draw the Class Diagram in UML Diagram

What is class diagram in UML with example? BPO Management System

In software engineering, a class diagram in Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system showing the class -es of the system, their characteristics, operations (or methods), and relationships between objects.

The class diagram is the main building block of object-oriented modeling. It is used for general conceptual modeling of the application’s structure, and translating the model into programming code for detailed modeling. Class diagrams can also be used for data modeling. Classes in a class diagram represent the main elements, both interactions in the application, and classes to be programmed.

Video of class diagram representation

In the diagram, classes are represented by boxes with three compartments:

  • The top box contains the class name. It is bold and focused, and the first letter is in the capital.
  • The middle compartment has square properties. They are left-aligned and the first letter is lowercase.
  • The bottom compartment contains the operations that the class can perform. They are left-aligned and the first letter is lowercase.

A class diagram with three compartments.

In the design of a system, several classes are identified and grouped together in a class diagram that helps determine the static relationships between them. With detailed modeling, the classes of conceptual design are often divided into several subclasses.

To further describe the behavior of the system, these class diagrams can be supplemented by a state diagram or a UML state machine.

class diagram
class diagram

Class diagram protected member

UML provides mechanisms to represent class members, such as attributes and methods, and additional information about them, such as constructors.

Class Diagram Attribute Visibility

To specify the visibility of a class member (ie any attribute or method), these notifications must be placed before the member’s name:

  • 1) + Public
  • 2) – Private
  • 3) # Protected
  • 4) ~ Package

A derived property is a property that is calculated from the output of values ​​(or values) or other information, for example, using values ​​of other properties.
The derived property is shown with its name preceded by a forward slash ‘/’.

Scope Of UML

UML specifies two types of scope for members: examples and classifiers, and the latter are denoted by underlined names.
Classifier member are commonly recognized as “static” in many programming language the scope is the class itself.

  • 1. Attribute values may between instance
  • 2. Method invocation may affect the instance’s state(i.e. change instance attributes

Instance member are to a specific instance

  • 1. Attribute values ​​may vary between instances
  • 2. The method invocation can affect the state of an instance (ie change the instance’s characteristics).

To indicate a classifier scope for a member, its name must be underlined. Otherwise, the instance scope is assumed by default.

How many Relationship in class diagram?

There are six uml relation notation. Those are given below:

  • Association
  • Generalization
  • Realization
  • Dependency
  • Aggregation
  • Composition
Relationship in class diagram
Relationships in class diagram

What are the different types of multiplicity in class diagram?

This relation suggests that (at least) one of the two related classes refers to each other. This relationship is usually described as “A in B” (a mother is a kitten, a kitten is a mother cat).

The UML representation of the association is a line connecting two associated classes. There is optional notation at each end of the line. For example, we can indicate that the pointed end is visible from the arrow’s tail using an arrow. We can indicate ownership by the placement of a ball, the elements of that end play by supplying a name for the role, and the plurality of instances of that entity (the range of the number of objects that participate in the association from the perspective at the other extreme).

  • 0 No instances (rare)
  • 0..1 No instances, or one instance
  • 1 exactly instances
  • 1..1 exactly one instances
  • 0 .. * zero or more instances
  • * Zero or more instances
  • 1 .. * One or more instances

Recommended Posts:

Get Salesforce Answers

Java Project for Beginners With complete uml diagram

Hi, I’m Pramod Kumar Yadav & a computer science Engineer with 3years of experience in Digital marketing. I’m self-motivated and love to do SEO.

Leave a Reply

%d bloggers like this: