1.3.1. Object Oriented Software Design
1.3.1. Object Oriented Software Design
Object Oriented Software Design methodology is a modular software design approach. Unified
Modelling Language (UML) is used to design a software system based on object oriented design
methodology.
1.3.1.1. UML
UML stands for ‘Unified Modelling Language’. It is standardized in 1997 by the OMG (Object
Management Group). It matches with the growing complexity of systems.
It is used for both software and systems engineering. Now a days it is the de facto standard for
Software Modelling for Object Oriented Design.
UML being graphical, recommends various diagrams to be generated as part of the design. There are
tools available for drawing such diagrams and there are tools available to translate the design to code
(containing stubs) in desired programming language (such as C++, Java etc).
Fig 1.3.1.1 illustrated different diagrams recommended by UML 2.0. As a designer, we need not
generate all the diagrams. It should be done on need basis and may vary from project to project. The
designer should decide on which all diagrams to make for his/her design. The most important diagram
is the ‘Class Diagram’ which we will deal with in the subsequent sections.
Fig 1.3.1.1. UML 2.0 Diagrams
Source:
http://archive.oredev.org/download/18.5bd7fa0510edb4a8ce4800019180/1385353960592/
Bruce_Douglass_-_Workshop_Real-Time_UML.pdf
An object is a run-time entity that may occupies memory at some specific point in time. It is a data
structure that also provides services that act on that data. An object exists at run-time only.
An object
A class is the specification of a set of objects that share a common structure and behaviours.
o Attributes
o Methods
Attributes are the data specified within a class (or encapsulated within an object)
1.3.1.2.3. Class
There are some classes which are not instantiated, because their specification is not complete. They
are called ‘Abstract Classes’. These classes define the operations, but not implement the methods.
But abstract classes can be instantiated by derived classes.
In C++, abstract class is defined as a class having at least one pure virtual operation.
Abstract classes and pure virtual operations are identified by italics in UML.
1.3.1.2.4. Types of Visibility
There are different types of visibility for the attributes and methods of a classes, which are
following.
Private: Only methods inside the same class can access the private attribute or method. Private
members are indicated by ‘–’ in UML.
Protected: Only methods inside the same class and derived classes can access the protected
attribute or method. Protected members are indicated by ‘#’ in UML.
Public: Public attribute or method can be accessed by anyone outside the class. Public members
are indicated by ‘+’ in UML.
Package (rarely used): Only elements inside the same package can access the package attribute
or method. Package members are indicated by ‘~’ in UML.
In UML, a class is represented by a rectangle having three vertical division. These three inner
rectangles contain the followings in a top to bottom order.
Class name
Modifiers are the symbols prepended to the class attributes and operations as per their visibility
discussed in the previous section. Followings are the modifiers as per the visibility.
o Private: -
o Public: +
o Protected: #
o Package: ~
Fig 1.3.1.1 shows the representation of a class in UML. It also shows an example of a ‘Car Controller’
class, which is a part of an elevator system.
Fig. 1.3.1.1. Class representation in UML