UML Class Diagram Tutorial

Categories:

Recommended

UML Class Diagram Tutorial

8-10 minutes

The UML Class diagram is a graphical notation used to construct and visualize object oriented systems. 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

What is a Class?

A Class is a blueprint for an object. Objects and classes go hand in hand. We can’t talk about one without talking about the other. And the entire point of Object-Oriented Design is not about objects, it’s about classes, because we use classes to create objects. So a class describes what an object will be, but it isn’t the object itself.

In fact, classes describe the type of objects, while objects are usable instances of classes. Each Object was built from the same set of blueprints and therefore contains the same components (properties and methods). The standard meaning is that an object is an instance of a class and object – Objects have states and behaviors.

Example

A dog has states – color, name, breed as well as behaviors -wagging, barking, eating. An object is an instance of a class.

UML Class Notation

A class represent a concept which encapsulates state ( attributes ) and behavior( operations ). Each attribute has a type. Each operation has a signature . The class name is the only mandatory information .

Class Name:

The name of the class appears in the first partition.

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.

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 are shown after the colon following the parameter name. Operations map onto class methods in code

Class Visibility

The +, – and # symbols before an attribute and operation name in a class denote the visibility of the attribute and operation.

  • + denotes public attributes or operations
  • – denotes private attributes or operations
  • # denotes protected attributes or operations Parameter Directionality

Each parameter in an operation (method) may be denoted as in, out or in out which specifies its direction with respect to the caller. This directionality is shown before the parameter name.

Perspectives of Class Diagram

The choice of perspective depends on how far along you are in the development process. During the formulation of a domain model , for example, you would seldom move past the conceptual perspective . Analysis models will typically feature a mix of conceptual and specification perspectives . Design model development will typically start with heavy emphasis on the specification perspective , and evolve into the implementation perspective .

Category:

VP Flipbook Maker

Created a flipbook like this. This flipbook is made with Visual Paradigm Online. Try this free flipbook maker and create you own flipbook now!