Unit-3 Notes
Unit-3 Notes
2
Characteristics of OOD
3
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.
4
Object Design
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.
The objects discovered during analysis serve as the skeleton of the design, but the
object designer must choose among different ways to implement them with an eye toward
minimizing execution time, memory and other measures of cost.
The operations identified during the analysis must be expressed as algorithms, with
complex operations decomposed into simpler internal operations.
During object design, the designer must perform the following steps:
1. Combining the three models to obtain operations on classes.
2. Design algorithms to implement operations.
3. Optimize access paths to data.
4. Implement control for external interactions
5. Adjust class structure to increase inheritance.
6. Design associations.
7. Determine object representation.
8. Package classes and associations into modules. 6
Combining the three models to obtain operations on classes.
After analysis, we have object, dynamic and functional model, but the object model is
the main framework around which the design is constructed.
7
Dynamic Model: The dynamic model is used to express and model the behavior of the
system over time. It includes support for activity diagrams, state diagrams, sequence
diagrams and extensions including business process modeling.
Functional Model: A function model or functional model in systems engineering and
software engineering is a structured representation of the functions (activities, actions,
processes, operations) within the modeled system or subject area.
A function model, also called an activity model or process model, is a graphical
representation of an enterprise's function within a defined scope. The purposes of the
function model are to describe the functions and processes, assist with discovery of
information needs, help identify opportunities, and establish a basis for determining
An event sent by an object may represent an operation on another object .Events often
occur in pairs , with the first event triggering an action and the second event returning
the result on indicating the completion of the action.
9
An action or activity initiated by a transition in a state diagram may expand into an
entire DFD in the functional model .
The network of processes within the DFD represents the body of an operation. The
flows in the diagram are intermediate values in operation.
The designer convert the graphic structure of the diagram into linear sequence of steps
in the algorithm .
The process in the DFD represent sub-operations. Some of them, but not necessarily all
may be operations on the original target object or on other objects.
10
Designing algorithms
Each operation specified in the functional model must be formulated as an algorithm.
The analysis specification tells what the operation does from the view point of its
clients, but the algorithm shows how it is done.
An algorithm may be subdivided into calls on simpler operations, and so on
recursively, until the lowest-level operations are simple enough to implement directly
without refinement .
12
ii) Choosing Data Structures
Choosing algorithms involves choosing the data structures they work on.
We must choose the form of data structures that will permit efficient algorithms.
The data structures do not add information to the analysis model, but they organize
it in a form convenient for the algorithms that use it.
13
iii) Defining Internal Classes and Operations
During the expansion of algorithms, new classes of objects may be needed to hold
intermediate results.
New, low level operations may be invented during the decomposition of high level
operations.
A complex operation can be defined in terms of lower level operations on simpler objects.
These lower level operations must be defined during object design because most of them are
not externally visible.
There is a need to add new internal operations as we expand high –level functions. When you
reach this point during the design phase, you may have to add new classes that were not
mentioned directly in the client‟s description of the problem. These low-level classes are the
implementation elements out of which the application classes are built. 15
iv) Assigning Responsibility for Operations
Many operations have obvious target objects, but some operations can be performed at
several places in an algorithm, by one of the several places, as long as they eventually get
done.
Such operations are often part of a complex high-level operation with many
consequences.
When a class is meaningful in the real world, then the operations on it are usually clear.
During implementation, internal classes are introduced.
15
Design Optimization
The basic deign model uses the analysis model as the framework for implementation .
The analysis model captures the logical information about the system, while the design
model must add details to support efficient information access.
The inefficient but semantically correct analysis model can be optimized to make the
implementation more efficient, but an optimized system is more obscure and less likely
to be reusable in another context.
The designer must strike an appropriate balance between efficiency and clarity.
During design optimization, the designer must
I. Add Redundant Associations for Efficient Access
II. Rearranging Execution Order for Efficiency
III. Saving Derived Attributes to Avoid Re-computation:
16
Implementation of Control
The designer must refine the strategy for implementing the state – event models
present in the dynamic model. There are three basic approaches to implementing the
dynamic model:
18
Adjustment of Inheritance
The definitions of classes and operations can often be adjusted to increase the amount of inheritance.
The designer should:
Rearrange classes and operations: Sometimes the same operation is defined across several
classes and can easily be inherited from a common ancestor, but more often operations in different
classes are similar but not identical. By slightly modifying the definitions of the operations or the
classes , the operations can often be made to match so that they can be covered by a single
inherited operation.
Abstracting Out Common Behavior: Reexamine the object model looking for commonality
between classes. New classes and operations are often added during design. If a set of operations /
attributes seems to be repeated in two classes , it is possible that the two classes are specialized
variations of the sane thing. When common behavior has been recognized , a common super class
can be created that implements the shared features , specialized features in subclass. This
transformation of the object model is called abstracting out a common super class / common
behavior .
Use Delegation to Share Implementation: Sometimes programmers use inheritance as an
implementation technique with no intention of guaranteeing the same behavior. Sometimes an
existing class implements some of the behavior that we want to provide in a newly defined class,
although in other respects the two classes are different. The designer may inherit from the existing
class to achieve part of the implementation of the new class. This can lead to problems –unwanted
behavior. 20
Design of Associations
During object design phase, we must formulate a strategy for implementing all
associations in the object model.
Analyzing Association Traversal: Associations are inherently bidirectional. If
association in your application is traversed in one direction, their implementation can
be simplified.
One-way association: If an association is only traversed in one direction it may be
implemented as pointer.
Two-way associations: Many associations are traversed in both directions, although
not usually with equal frequency.
Link Attributes: Its implementation depends on multiplicity. If it is a one-one
association , link attribute is stored in any one of the classes involved. If it is a many-
one association, the link attribute can be stored as attributes of many object ,since each
―many object appears only once in the association. If it is a many-many association,
the link attribute can‟t be associated with either object; implement association as
distinct class where each instance is one link and its attributes.
21
Object Representation
Implementing objects is mostly straight forward, but the designer must choose when to
use primitive types in representing objects and when to combine groups of related
objects.
Classes can be defined in terms of other classes, but eventually everything must be
implemented in terms of built-in-primitive data types, such as integer strings, and
enumerated types.
Functional model will also be extended which specifies all operation interfaces by giving their
arguments, results, input-output mappings and side effects.
From analysis to design, it is probably a good idea to keep the Design Document distinct from the
Analysis Document. Because of the shift in viewpoint from an external user’s view to an internal
implementer’s view, the design document includes many optimizations and implementation
24
artifacts.
• Design Document = Detailed Object Model +
Detailed Dynamic Model +
Detailed Functional Model
24
Structured analysis and structured design
(SA/SD),
Jackson Structured Development (JSD)
25
Introduction
Object oriented design is a method where developers think in terms of objects
instead of procedures or functions.
SA/SD approach is based on the data flow Diagram.
JSD approach is action-oriented.
SA/SD is easy to understand but it focuses on well defined system boundary
whereas JSD approach is too complex and does not have any graphical
representation.
SA/SD
SA/SD is diagrammatic notation which is design to help people understand the
system.
The basic goal of SA/SD is to improve quality and reduce the risk of System
failure.
It establishes concrete management specification and documentation. It focuses
on reliability, flexibility and maintainability of system.
In this system it involves 2 phases.
1. Analysis Phase: It uses DFD, Data Dictionary, State Transition diagram and ER
diagram.
2. Design Phase: Structure Chart, Pseudo Code
SA/SD
Analysis Phase:
Data Flow Diagram: In a DFD model describe how the data flows through the
system.
Data Dictionary: The content that is missing from DFD is described in the data
dictionary. Data Dictionary defines the Data store and there relevant meaning.
State Transition Diagrams is similar to Dynamic model .It specifies how much
time function will take to execute and data access triggered by events.
ER Diagram: It specifies the relationship between data store
SA/SD
Design Phase: Structure Chart, Pseudo Code
Structure Chart: It is created by the DFD. Structure Chart specifies how DFD‟s
processes are grouped in to task and allocate to CPU‟s.
Specification Phase:
This phase focuses on actually what is to be done? Previous phase provides the basic
for this phase. An sufficient model of a time-ordered world must itself be time-ordered.
Major goal is to map progress in the real world on progress in the system that models it.
Jackson Structured Development (JSD)
Implementation Phase:
In the implementation phase JSD determines how to obtain the required
functionality. Implementation way of the system is based on transformation of
specification into efficient set of processes. The processes involved in it should be
designed in such a manner that it would be possible to run them on available
software and hardware.
JSD Steps
Initially there were six steps when it was originally presented by Jackson:
1. Entity/action step:
2. Initial model step:
3. Interactive function step
4. Information function step
5. System timing step
6. System implementation step
JSD Steps
1. Entity/action step: The entities perform actions in time. The action is atomic and
cannot be decomposed further.
2. Initial model step: we concentrate on state vector and data stream communication.
3. Interactive function step: consist of pseudo code to the output of action generated
from states. In this step the developer requires a complete specification of the system.
4. Information function step: consist of pseudo code to the output of action generated
from states. In this step the developer requires a complete specification of the system.
5. System timing step: relates with the performance constraints of the system.
6. System implementation step: focuses on process scheduling and allocates the number
of processors required. The process may be different form the processors
Jackson Structured Development (JSD)
Later some steps were combined to create method with only three steps:
1. Modeling Step: This Stage comprises of Entity Action and Entity Structure.
2. Network Step: Initial model step, Function Step, and System Timing Step.
3. Implementation Step: Implementation Stage
Merits of JSD
It is a poor methodology for high level analysis and data base design.
JSD is a complex methodology due to pseudo code representation.
It is less graphically oriented as compared to SA/SD or OMT.
It is a bit complex and difficult to understand.
Data Flow Diagram (DFD)
Data flow diagram (DFD)
A process model used to depict the flow of data through a system and the work or
processing performed by the system. Synonyms are bubble chart, transformation
graph, and process model.
The DFD has also become a popular tool for business process redesign.
A graphical tool, useful for communicating with users, managers, and other personnel.
Used to perform structured analysis to determine logical requirements.
Useful for analyzing existing as well as proposed systems.
Focus on the movement of data between external entities and processes, and between
processes and data stores.
Differences Between DFDs and Flowcharts
Processes on DFDs can operate in parallel (at-the-same-time)
-Processes on flowcharts execute one at a time
DFDs show the flow of data through a system
-Flowcharts show the flow of control (sequence and transfer of control)
Processes on a DFD can have dramatically different timing (daily, weekly, on
demand)
-Processes on flowcharts are part of a single program with consistent timing
41
Why DFD ?
Provides an overview of-
o What data a system processes
o What transformations are performed
o What data are stored
o What results are produced and where they flow
Processverbphrase
1.0
The work or actions performed on data so that they are transformed, stored, or
distributed.
Process labels should be verb phrases!
Data Flow
2.1
Payment Detail
D1 Accounts
Post Invoice Detail Receivable
Payment
A path for data to move from one part of the system to another.
Data in motion!
Arrows depict the movement of data.
Data Store
D1 Students
1.0
Order
CUSTOMER Invoice
Verify
Order
The origin or destination of data! – This represents things outside of the system.
Source – Entity that supplies data to the system.
Sink – Entity that receives data from the system.
Advantages of DFDs
Simple graphical techniques which are easy to understand
Helps define the boundaries of the system
Useful for communicating current system knowledge to users
Explains the logic behind the data flow within the system
Used as the part of system documentation file
Decomposition Of DFD
Levels Description Explanation
Note: There is no rule as to how many levels of DFD that can be used.
Creating Data Flow Diagrams
Creating DFDs is a highly iterative process of gradual refinement.
General steps:
1. Create a preliminary Context Diagram
2. Identify Use Cases, i.e. the ways in which users most commonly use the system
3. Create DFD fragments for each use case
4. Create a Level 0 diagram from fragments
5. Decompose to Level 1,2,…
6. Go to step 1 and revise as necessary
7. Validate DFDs with users.
Types of Diagrams
• Context Diagram
• A data flow diagram (DFD) of the scope of an organizational system that
shows the system boundaries, external entities that interact with the system
and the major information flows between the entities and the system
• Level-O Diagram
• A data flow diagram (DFD) that represents a system’s major processes, data
flows and data stores at a high level of detail
54
Context diagram of Burger’s Food ordering system
55
Level-0 DFD of food ordering system
56
A Context Diagram (Level 0)
The major information flows between the entities and the system.
A Context Diagram addresses only one process.
Rules for Level 0 Diagram
• Reusability in Java means that once you write some code, you can use it over and
over again - if you write it so that it can be reused.
65
Object oriented programming style:
Extensibility
• In software engineering, extensibility is a system design principle where the
implementation takes into consideration future growth.
• It is a systemic measure of the ability to extend a system and the level of effort
required to implement the extension.
• Extensions can be through the addition of new functionality or through modification
of existing functionality.
• The central theme is to provide for change – typically enhancements – while
minimizing impact to existing system functions
66
Object oriented programming style:
• Robustness
consider two of the main reasons for program failure: memory management mistakes
and mishandled exceptional conditions.
• Memory management : de allocation is completely automatic, because Java
provides garbage collection for unused objects.
• Mishandled exceptional: Java program, all run-time errors can—and should— be
managed by your program.
67
Thanks
68