UML Class Notation
class notation is a graphical representation used to depict classes and their relationships in object-oriented modeling.
- Class Name:
- The name of the class is typically written in the top compartment of the class box and is centered and bold.
- Attributes:
- Attributes, also known as properties or fields, represent the data members of the class. They are listed in the second compartment of the class box and often include the visibility (e.g., public, private) and the data type of each attribute.
- Methods:
- Methods, also known as functions or operations, represent the behavior or functionality of the class. They are listed in the third compartment of the class box and include the visibility (e.g., public, private), return type, and parameters of each method.
- Visibility Notation:
- Visibility notations indicate the access level of attributes and methods. Common visibility notations include:
+
for public (visible to all classes)-
for private (visible only within the class)#
for protected (visible to subclasses)~
for package or default visibility (visible to classes in the same package)
- Visibility notations indicate the access level of attributes and methods. Common visibility notations include:
Parameter Directionality
In class diagrams, parameter directionality refers to the indication of the flow of information between classes through method parameters. It helps to specify whether a parameter is an input, an output, or both. This information is crucial for understanding how data is passed between objects during method calls.
There are three main parameter directionality notations used in class diagrams:
- In (Input):
- An input parameter is a parameter passed from the calling object (client) to the called object (server) during a method invocation.
- It is represented by an arrow pointing towards the receiving class (the class that owns the method).
- Out (Output):
- An output parameter is a parameter passed from the called object (server) back to the calling object (client) after the method execution.
- It is represented by an arrow pointing away from the receiving class.
- InOut (Input and Output):
- An InOut parameter serves as both input and output. It carries information from the calling object to the called object and vice versa.
- It is represented by an arrow pointing towards and away from the receiving class.
Class Diagram | Unified Modeling Language (UML)
Class diagrams are a type of UML (Unified Modeling Language) diagram used in software engineering to visually represent the structure and relationships of classes in a system. UML is a standardized modeling language that helps in designing and documenting software systems. They are an integral part of the software development process, helping in both the design and documentation phases.
Important Topics for the Class Diagram
- What are class Diagrams?
- What is a class?
- UML Class Notation
- Relationships between classes
- Purpose of Class Diagrams
- Benefits of Class Diagrams
- How to draw Class Diagrams
- Use cases of Class Diagrams