OOAD – UML Basic Notations

  • Post author:
  • Post category:OOAD
  • Post comments:1 Comment
OOAD - UML Basic Notations

OOAD UML Basic Notations defines specific notations for each of the building blocks.

Class Of OOAD UML Basic Notations

A class is represented by a rectangle having three sections βˆ’

  • the top section containing the name of the class
  • the middle section containing class attributes
  • the bottom section representing operations of the class

The visibility of the attributes and operations can be represented in the following ways βˆ’

  • Public βˆ’ A public member is visible from anywhere in the system. In class diagram, it is prefixed by the symbol β€˜+’.
  • Private βˆ’ A private member is visible only from within the class. It cannot be accessed from outside the class. A private member is prefixed by the symbol β€˜βˆ’β€™.
  • Protected βˆ’ A protected member is visible from within the class and from the subclasses inherited from this class, but not from outside. It is prefixed by the symbol β€˜#’.

An abstract class has the class name written in italics.

ExampleΒ βˆ’ Let us consider the Circle class introduced earlier. The attributes of Circle are x-coord, y-coord, and radius. The operations are find area(), find circumference(), and scale(). Let us assume that x-coord and y-coord are private data members, the radius is a protected data member, and the member functions are public. The following figure gives the diagrammatic representation of the class.

OOAD - UML Basic Notations

Object

An object is represented as a rectangle with two sections βˆ’

  • The top section contains the name of the object with the name of the class or package of which it is an instance of. The name takes the following forms βˆ’
    • object-name βˆ’ class-name
    • object-name βˆ’ class-name :: package-name
    • class-name βˆ’ in case of anonymous objects
  • The bottom section represents the values of the attributes. It takes the form attribute-name = value.
  • Sometimes objects are represented using rounded rectangles.

Example βˆ’ Let us consider an object of the class Circle named c1. We assume that the center of c1 is at (2, 3) and the radius of c1 is 5. The following figure depicts the object.

OOAD - UML Basic Notations

Component

A component is a physical and replaceable part of the system that conforms to and provides the realization of a set of interfaces. It represents the physical packaging of elements like classes and interfaces.

Notation βˆ’ In UML diagrams, a component is represented by a rectangle with tabs as shown in the figure below.

OOAD - UML Basic Notations

Interface

The interface is a collection of methods of a class or component. It specifies the set of services that may be provided by the class or component.

Notation βˆ’ Generally, an interface is drawn as a circle together with its name. An interface is almost always attached to the class or component that realizes it. The following figure gives the notation of an interface.

Package

A package is an organized group of elements. A package may contain structural things like classes, components, and other packages.

NotationΒ βˆ’ Graphically, a package is represented by a tabbed folder. A package is generally drawn with only its name. However, it may have additional details about the contents of the package. See the following figures.

Relationship

The notations for the different types of relationships are as follows βˆ’

Usually, elements in a relationship play specific roles in the relationship. A role name signifies the behavior of an element participating in a certain context.

ExampleΒ βˆ’ The following figures show examples of different relationships between classes. The first figure shows an association between two classes, Department and Employee, wherein a department may have a number of employees working in it. The worker is the role name. The β€˜1’ alongside Department and β€˜*’ alongside Employee depict that the cardinality ratio is one–to–many. The second figure portrays the aggregation relationship, a University is the β€œwhole–of” many Departments.

OOAD - UML Basic Notations

Next Topic – Click Here

This Post Has One Comment

Leave a Reply