Chap 5.3OODesign222
Chap 5.3OODesign222
Chap 5.3OODesign222
1
Object Oriented Design
• Designing object-oriented software is hard, and
designing reusable object-oriented software is even
harder.
• Your design should be specific to the problem at hand
but also general enough to address future problems and
requirements.
• You also want to avoid redesign, or at least minimize
it.
• Before a design is finished, they usually try to reuse it
several times, modifying it each time.
2
Object Oriented Design
• OOD is divided into two major activities:
1) System design and
2) Object design.
• System design
Creates the product architecture, defining a
series of “layers” that accomplish specific
system functions
Identifying the classes that are encapsulated by
subsystems that reside at each layer.
3
Cont…
• In addition, system design considers the
specification of three components:
– The user interface,
– Data management functions, and
– Task management facilities.
• Object design focuses on the internal detail of
individual classes, defining attributes,
operations, and message detail.
4
Cont…
• A detailed specification of attribute data structures and a
procedural design of all operations are created during
object design.
• The visibility for all class attributes is defined and
interfaces between objects are elaborated to define the
details of a complete messaging model.
• System and object design in UML are extended to
consider the design of user interfaces, data management
with the system to be built, and task management for the
subsystems that have been specified.
5
Object Oriented Design
7
Object Oriented Design
• The unique nature of object-oriented design lies in its
ability to build upon four important software design
concepts:
• Abstraction,
• Information hiding,
• Functional independence, and
• Modularity.
• All design methods try for software that exhibits these
fundamental characteristics,
• But only OOD provides a mechanism that enables the
designer to achieve all four without complexity or
compromise.
8
Object Oriented Design
DESIGN FOR OBJECT-ORIENTED SYSTEMS
The four layers of the OO design pyramid are:
1) The subsystem layer contains a representation of each of the
subsystems that enable the software to achieve its customer-
defined requirements and to implement the technical
infrastructure that supports customer requirements.
2) The class and object layer contains the class hierarchies that
enable the system to be created using generalizations and
increasingly more targeted specializations.
This layer also contains representations of each object.
9
Cont…
3) The message layer contains the design details that
enable each object to communicate with its
collaborators.
This layer establishes the external and internal
interfaces for the system.
4) The responsibilities layer contains the data
structure and algorithmic design for all attributes and
operations for each object.
10
Object Oriented Design
14
THE SYSTEM DESIGN PROCESS: cont..
• As subsystems are defined (and designed), they should conform
to the following design criteria:
1) The subsystem should have a well-defined interface
through which all communication with the rest of the
system occurs.
2) With the exception of a small number of
“communication classes,” the classes within a subsystem
should collaborate only with other classes within the
subsystem.
3) The number of subsystems should be kept low.
4) A subsystem can be partitioned internally to help reduce
complexity.
• When two subsystems communicate with one another, they can
establish a client-server link or a peer-to-peer link. 15
THE SYSTEM DESIGN PROCESS: cont..
16
Cont…
• On the other hand, if classes (or subsystems) must act
on events asynchronously and at the same time, they
are viewed as concurrent.
• When subsystems are concurrent, two allocation
options exist:
• Allocate each subsystem to an independent processor
or
• Allocate the subsystems to the same processor and
provide concurrency support through operating
system features.
17
THE SYSTEM DESIGN PROCESS: cont..
3) The Task Management Component
The characteristics of a task are determined by
understanding how the task is initiated.
Event-driven and clock-driven tasks are the most
commonly encountered.
Both are activated by an interrupt, but Event-driven
receives an interrupt from some outside source (e.g.,
another processor, a sensor) while clock-driven is
governed by a system clock.
In addition to the manner in which a task is initiated,
the priority and criticality of the task must also be
determined.
18
Cont…
• High-priority tasks must have immediate access to
system resources.
• High-criticality tasks must continue to operate even
if resource availability is reduced or the system is
operating in a degraded state.
• Once the characteristics of the task have been
determined, object attributes and operations
required to achieve coordination and communication
with other tasks are defined.
19
THE SYSTEM DESIGN PROCESS: cont..
20
Cont…
• These serve as input to the user interface design
process.
• Because a wide variety of user interface
development environments already exist, the design
of GUI elements is not necessary.
• Reusable classes (with appropriate attributes and
operations) already exist for windows, icons, mouse
operations, and a wide variety of other interaction
functions.
21
THE SYSTEM DESIGN PROCESS: cont..
5) The Data Management Component
Data management incorporates two distinct areas of concern:
1) The management of data that are critical to the application
itself
2) The creation of an infrastructure for storage and retrieval of
objects.
Within the system context, a database management system
is often used as a common data store for all subsystems.
The design of the data management component includes the
design of the attributes and operations required to manage
objects.
22
THE SYSTEM DESIGN PROCESS: cont..
7) Inter-subsystem Communication
• Once each subsystem has been specified, it is
necessary to define the collaborations that exist
between the subsystems.
• The model that we use for object-to-object
collaboration can be extended to subsystems as a
whole.
• As we noted earlier in this chapter, communication can
occur by establishing a client/server link or a peer-to-
peer link.
• We must specify the contract that exists between
subsystems.
24
Object Oriented Design
27
THE OBJECT DESIGN PROCESS cont…….