Kashipara.com is a community of 5.00 lakh programmers and students, just like you, helping each other. Join them; it only takes a minute: Sign Up

Class Diagram tutorial and examples

We are here to give you a full tutorial of making project report for any project of software. This project report or presentation will make your project easily understandable to client or user. In this, you represt your project by the help of daigrams i.e. class diagram, DFD diagram, ER diagram, Sequence diagram, Use Case dagram etc. We will cover all these topic in my tutorial. So, lets start the tutorial.

Basic information about class diagram

What is Class Diagram?

Class diagram is a static diagram. Class diagram is not only used for visualizing, describing, and documenting different aspects of a system but also for constructing executable code of the software application. It shows relationships between classes, objects, attributes, and operations.
Class Diagram example

Ntoation And Symbols Used in Class Diagram?


Classes represent an abstraction of entities with common characteristics. Associations represent the relationships between classes. In Example, classes with rectangles divided into compartments. Write the name of the class in the first partition, Enter the attributes in the second partition, and write all the operations into the third.

Classes in Class Diagram example

Active Classes

classes initiate and control the flow of activity, while passive classes store data and serve other classes. Active Class is show with thicker border.

Active Classes in Class Diagram example


Visibility markers are used to signify who can access the information contained within a class. Private visibility, denoted with a - sign, hides information from anything outside the class partition. Public visibility, denoted with a + sign, allows all other classes to view the marked information. Protected visibility, denoted with a # sign, allows child classes to access information they inherited from a parent class.

Visibility Class Diagram example


It represent static relationships between classes. Write association names above, on, or below the association line. Use a filled arrow to indicate the direction of the relationship. Place roles near the end of an association. Roles represent that two classes see each other.

Associations Class Diagram example


Place multiplicity notations near the ends of an association. These symbols indicate the linking of instances of one class from another. For example, one company will have one or more employees, but each employee works for just one company.

Multiplicity Class Diagram example


Constraints lies inside curly braces {}.

Constraint Class Diagram example

Composition and Aggregation

Composition is a special type of aggregation that denotes a strong ownership between Class A, the whole, and Class B, its part. Illustrate composition with a filled diamond. It is also called as shared association. Composition example here every car has a engine
Whereas, Aggregation Use a hollow diamond to represent a simple aggregation relationship, in which the "whole" class plays a more important role than the "part" class, but the two classes are not dependent on each other. Aggregation example here cars may have passengers,they come and go.

Composition and Aggregation Class Diagram example

Generalization Or Inheritance

Generalization is also called as inheritance which means (is-a) reltionship or inherit the property of one class in another class. For example, Honda is a type of car. So the class Honda would have a generalization relationship with the class car.

Generalization Or Inheritanc Class Diagram example

Examples Of Class Diagram

Ticket Reservation Class Diagram

Ticket Reservation Class Diagram example

College Seminar Management Class Diagram

College Seminar Management Class Diagram example