What is Class Diagram

Categories:

Recommended

What is Class Diagram?

10-13 minutes

In software engineering, a class diagram in the Unified Modeling Language (UML) 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 objects.

Are you looking for a Free UML tool for learning UML faster, easier and quicker? Visual Paradigm Community Edition is a UML software that supports all UML diagram types. It is an international award-winning UML modeler, and yet it is easy-to-use, intuitive &completely free.

Free Download

Purpose of Class Diagrams

  1. Shows static structure of classifiers in a system
  2. Diagram provides a basic notation for other structure diagrams prescribed by UML
  3. Helpful for developers and other team members too
  4. Business Analysts can use class diagrams to model systems from a business perspective

A UML class diagram is made up of:

  • A set of classes and
  • A set of relationships between classes

What is a Class

A description of a group of objects all with similar roles in the system, which consists of:

Structural features (attributes) define what objects of the class “know”

  • Represent the state of an object of the class
  • Are descriptions of the structural or static features of a class

Behavioral features (operations) define what objects of the class “can do”

  • Define the way in which objects may interact
  • Operations are descriptions of behavioral or dynamic features of a class

Class Notation

A class notation consists of three parts:

1. Class Name

  • The name of the class appears in the first partition.

2. Class Attributes

  • Attributes are shown in the second partition.
  • The attribute type is shown after the colon.
  • Attributes map onto member variables (data members) in code.

3. Class Operations (Methods)

  • Operations are shown in the third partition. They are services the class provides.
  • The return type of a method is shown after the colon at the end of the method signature.
  • The return type of method parameters is shown after the colon following the parameter name.
  • Operations map onto class methods in code

The graphical representation of the class – My Class as shown above:

  • My Class has 3 attributes and 3 operations
  • Parameter p3 of op2 is of type int
  • op2 returns a float op3 returns a pointer (denoted by a *) to Class6

Class Relationships

A class may be involved in one or more relationships with other classes. A relationship can be one of the following types: (Refer to the figure on the right for the graphical representation of relationships).

Category:

VP Flipbook Maker

This flipbook is created with Visual Paradigm Online flipbook maker. Make flipbooks like this and share with others. Try this online flipbook tool now!