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.
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.
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.
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.
Next Topic – Click Here
Pingback: OOAD - UML Analysis Model - Adglob Infosystem Pvt Ltd