You are on page 1of 20

Object-Oriented Analysis

Object–Oriented Analysis (OOA) is the procedure of identifying software


engineering requirements and developing software specifications in terms of a
software system’s object model, which comprises of interacting objects.
The main difference between object-oriented analysis and other forms of
analysis is that in object-oriented approach, requirements are organized around
objects, which integrate both data and functions.
The primary tasks in object-oriented analysis (OOA) are −

 Identifying objects
 Organizing the objects by creating object model diagram
 Defining the internals of the objects, or object attributes
 Defining the behavior of the objects, i.e., object actions
 Describing how the objects interact
The common models used in OOA are use cases and object models.

Object-Oriented Design

Object-Oriented Design
In the object-oriented design method, the system is viewed as a collection of
objects (i.e., entities). The state is distributed among the objects, and each object
handles its state data.

For example, in a Library Automation Software, each library representative


may be a separate object with its data and functions to operate on these data.
The tasks defined for one purpose cannot refer or change data of other objects.
Objects have their internal data which represent their state. Similar objects
create a class. In other words, each object is a member of some class. Classes
may inherit features from the superclass.

The different terms related to object design are:


1. Objects: All entities involved in the solution design are known as objects. For
example, person, banks, company, and users are considered as objects. Every entity
has some attributes associated with it and has some methods to perform on the
attributes.
2. Classes: A class is a generalized description of an object. An object is an instance of a
class. A class defines all the attributes, which an object can have and methods, which
represents the functionality of the object.
3. Messages: Objects communicate by message passing. Messages consist of the
integrity of the target object, the name of the requested operation, and any other
action needed to perform the function. Messages are often implemented as
procedure or function calls.
4. Abstraction In object-oriented design, complexity is handled using abstraction.
Abstraction is the removal of the irrelevant and the amplification of the essentials.
5. Encapsulation: Encapsulation is also called an information hiding concept. The data
and operations are linked to a single unit. Encapsulation not only bundles essential
information of an object together but also restricts access to the data and methods
from the outside world.
6. Inheritance: OOD allows similar classes to stack up in a hierarchical manner where
the lower or sub-classes can import, implement, and re-use allowed variables and
functions from their immediate superclasses.This property of OOD is called an
inheritance. This makes it easier to define a specific class and to create generalized
classes from specific ones.
7. Polymorphism: OOD languages provide a mechanism where methods performing
similar tasks but vary in arguments, can be assigned the same name. This is known as
polymorphism, which allows a single interface is performing functions for different
types. Depending upon how the service is invoked, the respective portion of the code
gets executed.

Object Design
After the hierarchy of subsystems has been developed, the objects in the system
are identified and their details are designed.The objects identified during analysis
are find out for implementation with an aim to minimize execution time, memory
consumption, and overall cost.
Object design includes the following phases −

 Object identification
 Object representation, i.e., construction of design models
 Classification of operations
 Algorithm design
 Design of relationships
 Implementation of control for external interactions
 Package classes and associations into modules

Object Identification
The first step of object design is object identification. The objects identified in the
object–oriented analysis phases are grouped into classes
The functions of this stage are −
 Identifying and refining the classes in each subsystem or package
 Defining the links and associations between the classes
 Designing the hierarchical associations among the classes, i.e., the
generalization/specialization and inheritances
 Designing aggregations

Object Representation
Once the classes are identified, they need to be represented using object modelling
techniques. This stage essentially involves constructing UML diagrams.
There are two types of design models that need to be produced −
 Static Models − To describe the static structure of a system using class
diagrams and object diagrams.
 Dynamic Models − To describe the dynamic structure of a system and show
the interaction between classes using interaction diagrams and state–chart
diagrams.
Classification of Operations
In this step, the operation to be performed on objects are defined by combining the
three models developed in the OOA phase, namely, object model, dynamic model,
and functional model. An operation specifies what is to be done and not how it
should be done.
The following tasks are performed regarding operations −
 The state transition diagram of each object in the system is developed.
 Operations are defined for the events received by the objects.
 Cases in which one event triggers other events in same or different objects
are identified.
 The sub–operations within the actions are identified.
 The main actions are expanded to data flow diagrams.

Algorithm Design
The operations in the objects are defined using algorithms. An algorithm is a
stepwise procedure that solves the problem laid down in an operation. Algorithms
focus on how it is to be done.
There may be more than one algorithm corresponding to a given operation. Once
the alternative algorithms are identified, the optimal algorithm is selected for the
given problem domain. The metrics for choosing the optimal algorithm are −
 Computational Complexity − Complexity determines the efficiency of an
algorithm in terms of computation time and memory requirements.
 Flexibility − Flexibility determines whether the chosen algorithm can be
implemented suitably, without loss of appropriateness in various
environments.
 Understandability − This determines whether the chosen algorithm is easy
to understand and implement.

Design of Relationships
The strategy to implement the relationships needs to be chalked out during the
object design phase. The main relationships that are addressed comprise of
associations, aggregations, and inheritances.
The designer should do the following regarding associations −
 Identify whether an association is unidirectional or bidirectional.
 Analyze the path of associations and update them if necessary.
 Implement the associations as a distinct object, in case of many–to-many
relationships; or as a link to other object in case of one–to-one or one–to-
many relationships.
Regarding inheritances, the designer should do the following −
 Adjust the classes and their associations.
 Identify abstract classes.
 Make provisions so that behaviors are shared when needed.
Packaging Classes
In any large project, 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.

Design Optimization
The analysis model captures the logical information about the system, while the
design model adds details to support efficient information access.
Before a design is implemented, it should be optimized so as to make the
implementation more efficient. The aim of optimization is to minimize the cost in
terms of time, space, and other metrics.
However, design optimization should not be excess, as ease of implementation,
maintainability, and extensibility are also important concerns. It is often seen that a
perfectly optimized design is more efficient but less readable and reusable. So the
designer must strike a balance between the two.
The various things that may be done for design optimization are −

 Add redundant associations


 Omit non-usable associations
 Optimization of algorithms
 Save derived attributes to avoid re-computation of complex expressions
Addition of Redundant Associations
During design optimization, it is checked if deriving new associations can reduce
access costs. Though these redundant associations may not add any information,
they may increase the efficiency of the overall model.

Omission of Non-Usable Associations


Presence of too many associations may render a system indecipherable and hence
reduce the overall efficiency of the system. So, during optimization, all non-usable
associations are removed.

Optimization of Algorithms
In object-oriented systems, optimization of data structure and algorithms are done in
a collaborative manner. Once the class design is in place, the operations and the
algorithms need to be optimized.
Optimization of algorithms is obtained by −

 Rearrangement of the order of computational tasks


 Reversal of execution order of loops from that laid down in the functional model
 Removal of dead paths within the algorithm

Saving and Storing of Derived Attributes


Derived attributes are those attributes whose values are computed as a function of
other attributes (base attributes). Re-computation of the values of derived attributes
every time they are needed is a time–consuming procedure. To avoid this, the
values can be computed and stored in their computed forms.
However, this may pose update anomalies, i.e., a change in the values of base
attributes with no corresponding change in the values of the derived attributes. To
avoid this, the following steps are taken −
 With each update of the base attribute value, the derived attribute is also re-
computed.
 All the derived attributes are re-computed and updated periodically in a group
rather than after each update.

Design Documentation
Documentation is an essential part of any software development process that
records the procedure of making the software. The design decisions need to be
documented for any non–trivial software system for transmitting the design to
others.

Usage Areas
Though a secondary product, a good documentation is indispensable, particularly in
the following areas −

 In designing software that is being developed by a number of developers


 In iterative software development strategies
 In developing subsequent versions of a software project
 For evaluating a software
 For finding conditions and areas of testing
 For maintenance of the software.

Contents
A beneficial documentation should essentially include the following contents −
 High–level system architecture − Process diagrams and module diagrams
 Key abstractions and mechanisms − Class diagrams and object diagrams.
 Scenarios that illustrate the behavior of the main aspects − Behavioural
diagrams

Features
The features of a good documentation are −
 Concise and at the same time, unambiguous, consistent, and complete
 Traceable to the system’s requirement specifications
 Well-structured
 Diagrammatic instead of descriptive

Implementation of Control
The object designer may incorporate refinements in the strategy of the state–
chart model. In system design, a basic strategy for realizing the dynamic model
is made. During object design, this strategy is aptly embellished for appropriate
implementation.

The approaches for implementation of the dynamic model are −

Represent State as a Location within a Program − This is the traditional


procedure-driven approach whereby the location of control defines the program
state. A finite state machine can be implemented as a program. A transition
forms an input statement, the main control path forms the sequence of
instructions, the branches form the conditions, and the backward paths form the
loops or iterations.
State Machine Engine − This approach directly represents a state machine
through a state machine engine class. This class executes the state machine
through a set of transitions and actions provided by the application.

Control as Concurrent Tasks − In this approach, an object is implemented as a


task in the programming language or the operating system. Here, an event is
implemented as an inter-task call. It preserves inherent concurrency of real
objects

What is Structured Analysis?


Structured Analysis is a development method that allows the analyst to understand
the system and its activities in a logical way.
It is a systematic approach, which uses graphical tools that analyze and refine the
objectives of an existing system and develop a new system specification which can
be easily understandable by user.
It has following attributes −
 It is graphic which specifies the presentation of application.
 It divides the processes so that it gives a clear picture of system flow.
 It is logical rather than physical i.e., the elements of system do not depend on
vendor or hardware.
 It is an approach that works from high-level overviews to lower-level details.

Structured Analysis Tools


During Structured Analysis, various tools and techniques are used for system
development. They are −

 Data Flow Diagrams


 Data Dictionary
 Decision Trees
 Decision Tables
 Structured English
 Pseudocode

Structured Design
Structured design is a conceptualization of problem into several well-organized
elements of solution. It is basically concerned with the solution design. Benefit of
structured design is, it gives better understanding of how the problem is being
solved. Structured design also makes it simpler for designer to concentrate on the
problem more accurately.
Structured design is mostly based on ‘divide and conquer’ strategy where a problem
is broken into several small problems and each small problem is individually solved
until the whole problem is solved.
The small pieces of problem are solved by means of solution modules. Structured
design emphasis that these modules be well organized in order to achieve precise
solution.
These modules are arranged in hierarchy. They communicate with each other. A
good structured design always follows some rules for communication among
multiple modules, namely -
Cohesion - grouping of all functionally related elements.
Coupling - communication between different modules.
A good structured design has high cohesion and low coupling arrangements.

Question:What is JSD? Explain this design with its advantages and


disadvantages.
Answer:
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.
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 states 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.

Steps for JSD software development

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.

How do you map the object oriented concept using


non object oriented languages?

Object oriented programming doesn't strictly require an object-oriented


programming language (although those are generally best suited for the job).
Object orientation, as a concept, means to create logical representations of
physical or conceptual items: a vehicle, a person, a manager, etc. Each object
type (commonly called a class) has a bundle of attributes (data items,
properties) and verbs (methods, functions). These bundles, together, form the
class.
It is thus possible to create constructs very close to modern classes as those
known in C++ using structures in C. In fact, the first C++ compilers (~20 years
ago) translated C++ into C, then used an existing C compiler to generate
executable code.
In C, a structure can
 contain variables (data members)
 pointers to functions (member functions)
 pointers to pointers of functions (virtual functions)
Among the many standard object-oriented techniques which can not be modeled
in C are
 privacy through visibility keywords (public, private, protected)
 inheritance (but a "derived" class can embed the "superclass" for a similar
effect)
 polymorphism
 contracts (interfaces)
 operator overloading
That said, object orientation as a design concept does not require an object
oriented language
Passing argumment means message passing and communication

Important methods of Parameter Passing

1. Pass By Value : . Changes made to formal parameter do not get


transmitted back to the caller.
2. Any modifications to the formal parameter variable inside the called
function or method affect only the separate storage location and will not
be reflected in the actual parameter in the calling environment.

3. This method is also called as call by value.

Pass by reference(aliasing) : . Changes made to formal parameter do


get transmitted back to the caller through parameter passing. Any
changes to the formal parameter are reflected in the actual parameter in
the calling environment as formal parameter receives a reference (or
pointer) to the actual data.
This method is also called as call by reference. This method is efficient
in both time and space.
Encapsulation
Encapsulation is the technique of making the fields in a class private and providing
access to the fields via public methods.

If a field is declared private, it cannot be accessed by anyone outside the class, thereby
hiding the fields within the class. For this reason, encapsulation is also referred to as data
hiding.

Encapsulation can be described as a protective barrier that prevents the code and data
being randomly accessed by other code defined outside the class.

Association
Association is a relationship where all object have their own lifecycle and there is no
owner. Let’s take an example of Teacher and Student.

Multiple students can associate with a single teacher and a single student can associate
with multiple teachers, but there is no ownership between the objects and both have
their own lifecycle.

Both can create and delete independently.


Translating classes into objects

In object oriented programming, a custom class (like Person class


with data of Name, list of addresses, etc)holds data and can include
collection objects too. A data structure is also used to hold data too.

So, is a class considered advanced data structure conceptually ? And


in design of efficient systems (in object oriented world and large
systems), are classes considered as similar to data structures and
algorithmic analysis done for efficient classes designs for greater
efficiency(in companies like google, facebook) ?

Abstract data type

An abstract data type is a data structure and a collection of functions or


procedures which operate on the data structure.

To align ourselves with OO theory, we'll call the functions and


procedures methods and the data structure and its methods a class, i.e. we'll call
our ADTs classes.

An instance of the class is called an object . Objects represent objects in the real
world and appear in programs as variables of a type defined by the class. These
terms have exactly the same meaning in OO design methodologies, but they have
additional properties such as inheritance that we will not discuss here.

some compiler support for OO design: this support must be provided by the
programmer in non-OO languages.

Object oriented programming style:


The capability of a class to derive properties and characteristics from another
class is called Inheritance. Inheritance is one of the most important features of
Object-Oriented Programming.

 Sub Class: The class that inherits properties from another class is called
Sub class or Derived Class.
 Super Class:The class whose properties are inherited by sub class is
called Base Class or Super class.
 Reusability: Inheritance supports the concept of “reusability”, i.e. when
we want to create a new class and there is already a class that includes
some of the code that we want, we can derive our new class from the
existing class. By doing this, we are reusing the fields and methods of the
existing class.

Example: Dog, Cat, Cow can be Derived Class of Animal Base Class.

In software engineering, extensibility is defined as “the quality of being


designed to allow the addition of new capabilities or functionality.” It is a
measure of the ability to extend a system and the level of effort required to
implement the extensions.

What is robustness of a software?


Robustness is one such important quality attribute which is defined by the IEEE
standard glossary of software engineering terminology [1] as: The degree to which
a system or component can function correctly in the presence of invalid inputs or
stressful environmental conditions.

Procedural V/S OOP


Both Procedural Oriented Programming (POP) and Object Oriented
Programming (OOP) are the high level languages in programming world and
are widely used in development of applications. On the basis of nature of
developing the code both languages have different approaches on basis of which
both are differentiate from each other.
Following are the important differences between Procedural Oriented
Programming (POP) and Object Oriented Programming (OOP)
Sr. Key Object Oriented Programming Procedural Oriented
No. (OOP) Programming (POP)

1 Definition Object-oriented Programming is On other hand Procedural


a programming language that Oriented Programming is a
uses classes and objects to programming language that
create models based on the real follows a step-by-step approach
world environment. In OOPs it to break down a task into a
makes it easy to maintain and collection of variables and
modify existing code as new routines (or subroutines)
objects are created inheriting through a sequence of
characteristics from existing instructions. Each step is carried
ones. out in order in a systematic
manner so that a computer can
understand what to do.

2 Approach In OOPs concept of objects and On other hand in case of POP


classes is introduced and hence the the main program is divided
the program is divided into small into small parts based on the
chunks called objects which are functions and is treated as
instances of classes. separate program for individual
smaller program.

3 Access In OOPs access modifiers are On other hand no such


modifiers introduced namely as modifiers are introduced in POP.
â~PrivateâTM, â~publicâTM, and
âTM~ProtectedâTM.

4 Security Due to abstraction in OOPs data On other hand POP is less


hiding is possible and hence it is secure as compare to OOPs.
more secure than POP.

5 Complexity OOPs due to modularity in its On other hand thereâTMs no


programs is less complex and simple process to add data in
hence new data objects can be POP at least not without revising
created easily from existing the whole program.
objects making object-oriented
programs easy to modify

OOPs (Object-Oriented Programming Features)


Object means a real-world entity such as a pen, chair, table, computer, watch,
etc. Object-Oriented Programming is a methodology or paradigm to design a
program using classes and objects. It simplifies software development and
maintenance by providing some concepts:

o Object
o Class
o Inheritance
o Polymorphism
o Abstraction
o Encapsulation

Apart from these concepts, there are some other terms which are used in Object-
Oriented design:

o Coupling
o Cohesion
o Association
o Aggregation
o Composition
Any entity that has state and behavior is known as an object. For example, a chair,
pen, table, keyboard, bike, etc. It can be physical or logical.

Another example can be to speak something; for example, a cat speaks meow, dog
barks woof, etc.

An Object can be defined as an instance of a class. An object contains an address and


takes up some space in memory. Objects can communicate without knowing the
details of each other's data or code. The only necessary thing is the type of message
accepted and the type of response returned by the objects.

Example: A dog is an object because it has states like color, name, breed, etc. as well
as behaviors like wagging the tail, barking, eating, etc.

Class
Collection of objects is called class. It is a logical entity.

A class can also be defined as a blueprint from which you can create an individual
object. Class doesn't consume any space.

Inheritance
When one object acquires all the properties and behaviors of a parent object, it is
known as inheritance. It provides code reusability. It is used to achieve runtime
polymorphism.
Polymorphism
If one task is performed in different ways, it is known as polymorphism. For example:
to convince the customer differently, to draw something, for example, shape,
triangle, rectangle, etc.

In C++, we use method overloading and method overriding to achieve


polymorphism.

Abstraction
Hiding internal details and showing functionality is known as abstraction. For example
phone call, we don't know the internal processing.

In Java, we use abstract class and interface to achieve abstraction.

Encapsulation
Binding (or wrapping) code and data together into a single unit are known as
encapsulation. For example, a capsule, it is wrapped with different medicines.

You might also like