Oosd Notes Unit3
Oosd Notes Unit3
Characteristics of OOD
Objects are abstractions of real-world or system entities and manage themselves.
Objects are independent and encapsulate state and representation information.
System functionality is expressed in terms of object services.
Shared data areas are eliminated.
Objects communicate by message passing.
Objects may be distributed and may execute sequentially or in parallel.
Advantages of OOD
Easier maintenance. Objects may be understood as stand-alone entities.
Objects are potentially reusable components.
For some systems, there may be an obvious mapping from real world entities to system objects.
Object Design
The object design phase comes after the analysis and system design. The object design phase adds
implementation details such as restructuring classes for efficiency, internal data structures and algorithms to
implement operations, implementation of control, implementation of associations and packaging into physical
modules. Object design extends the analysis.
The object design phase determines the full definitions of the classes and associations used in the
implementation, as well as the interfaces and algorithms of the methods used to implement operations. The
object design phase adds internal objects for implementation and optimizes data structures and algorithms.
OBJECT DESIGN STEPS:→ Object design is a very iterative process in which several classes (maybe
newly created), relationships between objects, are added when you move from one level to another level of
the design.
We can make a state diagram describing the life history of an object. A transition is a change of state of
object and it maps into an operation on the object. It helps in visualizing state changes. We can associate an
operation with each event received by an object. Also, sometimes an event may represent an operation on
another objects i.e., where one event triggers another event. Thus, in this case, the event pair must be
mapped into an operation performing action and returning control, provided that the events are on a single
thread of control passing from object to object. Any action initiated by transition in a state diagram can be
expanded into an entire data flow diagram in the functional model. The processes in a data flow diagram
consist of sub-operations which may be operational on the original target object, or on other objects.
6) Design of associations During the object design phase we must make a strategy to implement the
associations. Association can be unidirectional or bi-directional. Whichever implementation strategy we
choose, we should hide the implementation, using access operations to traverse and update the associations.
This will allow us to change our decision with minimal effort. The designer should:
i) Analyze the path of associations.
ii) Implement every association either as a distinct object, or as a link to another object.
7) Determine object representation As a designer, you must choose properly when to use primitive types
in representing objects, and when to combine groups of related objects, i.e., what is the exact representation
of object attributes.
8) Package classes and associations into models Programs are made of discrete physical units that can be
edited, complied, imported or otherwise manipulated. The careful partitioning of an implementation into
package is important for group work on a program. Packaging involves the following issues:
a. Information hiding
b. Collection of entities
c. Constructing physical modules with strong coupling within each module.
CHOOSING ALGORITHMS
In general, most of the operations are simple and have a satisfactory algorithm because the description of what is to be
done also indicates how it is to be done. Most of the operations in the object link network simply traverse to retrieve or
change attributes or links. Non-trivial algorithms are generally required for two reasons:
i) If no procedural specification is given for functions
ii) If a simple, but inefficient algorithm serves as a definition of function.
DESIGN OPTIMIZATION
The inefficient but correct analysis model can be optimized to make implementation more efficient. To optimize the
design, the following things should be done:
a) Adding Redundant Associations for Efficient Access
Redundant associations do not add any information, thus during design we should actually examine the structure of object
model for implementation, and try to establish whether we can optimize critical parts of the completed system. Can new
associations be added, or old associations be removed? The derived association need not to add any information to the
network, they help increasing the model information in efficient manner.
We can analyze the use of paths in the association network as follows:
• Evaluate each operation
• Find associations that it must pass through to get information. Associations can be bi-directional (generally by more than
one operation), or unidirectional, which can be implemented as pointers.
Packaging Classes
In any large project, meticulous partitioning of an implementation into modules or packages is important.
During object design, classes and objects are grouped into packages to enable multiple groups to work
cooperatively on a project.
The different aspects of packaging are −
• Hiding Internal Information from Outside View − It allows a class to be viewed as a “black box” and
permits class implementation to be changed without requiring any clients of the class to modify code.
• Coherence of Elements − An element, such as a class, an operation, or a module, is coherent if it is
organized on a consistent plan and all its parts are intrinsically related so that they serve a common goal.
• Construction of Physical Modules − The following guidelines help while constructing physical
modules −
o Classes in a module should represent similar things or components in the same composite object.
o Closely connected classes should be in the same module.
o Unconnected or weakly connected classes should be placed in separate modules.
o Modules should have good cohesion, i.e., high cooperation among its components.
o A module should have low coupling with other modules, i.e., interaction or interdependence
between modules should be minimum.
ADJUSTMENT OF INHERITANCE
During object design, inheritance is readjusted by rearranging classes and operations, and abstracting common behavior.
Rearranging Classes and Operations
The different, yet similar, operation of different classes can be slightly modified so that they can be covered by a single
inherited operation. The chances of inheritance can be increased by the following kind of adjustments:
i) Some operations needs less arguments than other similar operations, like drawing an object, e.g., circle, rectangle, etc.,
with, or without, color fill. Thus, the attribute color can be accepted, or ignored for consistency with color displays.
ii) Some operations need less argument than other, because they are special case of general arguments. Thus, varied newer
operation can be implemented by calling general operation and new argument values. For example, insertion in the
beginning or end of the list are special cases of insertion in the list.
iii) Different classes can have similar attributes, but different names. Thus, they can be combined and placed in the base
class so that the operation to access the attribute may match in different classes.
iv) Sometimes an operation is required by a subset of classes. In this case, declare the operation in base class, and all those
derived classes that do not need it can be declared as no-operation.
JSD, Jackson Structure Design is a methodology to specify and design systems in which time factor is
significant and system may be described using sequence of events. Developed by Michael A. Jackson , this
design method considers the fact that the design of the system is an extension of the programme design. The
purpose of this design method is to create a maintainable software. The method addresses all stages of the
software development life cycle. It has three phases:
1. Modeling phase - A JSD model starts with real world consideration. This phase is a part of analysis
process. The aspects of the real world relevant to the system being developed are modeled in this phase.
2. Specification phase - This phase focuses on the specification. In this phase JSD determines what is to be
done? The previous phase i.e. the modeling phase provides the basic for the system specifications to
achieve the required functionality.
3. implementation phase - In this phase , JSD determines how to achieve required functionality.
Operational specifications are executed so that it expresses desired system behavior in terms of some
abstract machine.
Ways of working
• The basic principle of operation of JSD is that development must start with describing and modeling the
real world rather than specifying the function performed by the system.
• The second principle states that an adequate model of a time ordered world must itself be time ordered.
The aim is to map progress in the real world on progress in the system that models it.
• The third principle stetes way of implementing the system based on transformation of specification in to
efficient set of processes. These processes should be designed in a manner to make them run on
available software and hardware.
Originally presented by Jackson in 1983 the method consisted of six steps which are following.
1. Entity /action step
2. Entity structure step
3. Initial model step
4. function step
5. system timing step
6. system implementing step
Later , some steps were combined to create a method with only three steps
1. Modeling stage (Analysis)
o Action step
o Structure step
2. Network stage (design)
o Initial model step
o Function step
o System timing step
3. Implementation stage (Realisation)
o System implementation step
Advantages of JSD
1. specially designed to handle real time problem.
2. JSD considers concurrent processing and timing.
3. JSD modeling focuses on time.
4. It provide functionality in the real world.
5. Excellent methodology for micro code application.
Disadvantages of JSD
1. JSD is a poor approach for high level analysis and data base design.
2. More complex due to pseudo code representation.
3. complex and difficult to understand.
4. less graphically oriented than SA/ SD and OMT.
The Structured Analysis/Structured Design (SASD) approach is the traditional approach of software
development based upon the waterfall model. The phases of development of a system using SASD are −
• Feasibility Study
• Requirement Analysis and Specification
• System Design
• Implementation
• Post-implementation Review
Now, we will look at the relative advantages and disadvantages of structured analysis approach and object-
oriented analysis approach.
Advantages/Disadvantages of Object Oriented Analysis
Advantages Disadvantages
Focuses on data rather than the procedures as Functionality is restricted within objects. This may pose a
in Structured Analysis. problem for systems which are intrinsically procedural or
computational in nature.
The principles of encapsulation and data hiding It cannot identify which objects would generate an optimal
help the developer to develop systems that system design.
cannot be tampered by other parts of the
system.
The principles of encapsulation and data hiding The object-oriented models do not easily show the
help the developer to develop systems that communications between the objects in the system.
cannot be tampered by other parts of the
system.
It allows effective management of software All the interfaces between the objects cannot be represented in
complexity by the virtue of modularity. a single diagram.
It is based upon functionality. The overall purpose is The initial cost of constructing the system
identified and then functional decomposition is done is high, since the whole system needs to
for developing the software. The emphasis not only be designed at once leaving very little
gives a better understanding of the system but also option to add functionality later.
generates more complete systems.
The specifications in it are written in simple English It does not support reusability of code. So,
language, and hence can be more easily analyzed the time and cost of development is
by non-technical personnel. inherently high.
Data abstraction is one of the most essential and important feature of object oriented programming in C++.
Abstraction means displaying only essential information and hiding the details. Data abstraction refers to
providing only essential information about the data to the outside world, hiding the background details or
implementation.
Consider a real life example of a man driving a car. The man only knows that pressing the accelerators will
increase the speed of car or applying brakes will stop the car but he does not know about how on pressing
accelerator the speed is actually increasing, he does not know about the inner mechanism of the car or the
implementation of accelerator, brakes etc in the car.
Advantages of Data Abstraction:
• Helps the user to avoid writing the low level code
• Avoids code duplication and increases reusability.
• Can change internal implementation of class independently without affecting the user.
• Helps to increase security of an application or program as only important details are provided to the user.
Data encapsulation is a mechanism of bundling the data, and the functions that use them and data
abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the
user.
Encapsulation is an Object Oriented Programming concept that binds together the data and functions that
manipulate the data, and that keeps both safe from outside interference and misuse. Data encapsulation led to
the important OOP concept of data hiding.