Unit III
Unit III
Unit III
• The design model provides detail about the software data structures, architecture,
interfaces, and components
• The design model can be assessed for quality and be improved before code is
generated and tests are conducted
– Can the design be implemented within the constraints, schedule, and cost
that have been established?
– The designer then chooses the elements from this collection that meet the
requirements defined by requirements engineering and analysis modelling
– Design begins at a high level of abstraction that can be directly traced back
to the data, functional, and behavioral requirements
– The data/class design transforms analysis classes into design classes along
with the data structures required to implement the software
Task
k Set for Software Design
Design:
1) Examine the information domain model and design appropriate data structures
for data objects and their attributes
2) Using the analysis model, select an architectural style (and design patterns) that
are appropriate for the software
3) Partition the analysis model into design subsystems and allocate these subsystems
within the architecture
b) Check each design class against design criteria; consider inheritance issues
Design Quality:
Quality's Role
– Serves as the foundation for all software engineering activities that follow
• The quality of the design is assessed through a series of formal technical reviews
or design walkthroughs
• The design must implement all of the explicit requirements contained in the
analysis model
• The design must be a readable and understandable guide for those who generate
code, and for those who test and support the software
• The design should provide a complete picture of the software, addressing the
data, functional, and behavioral domains from an implementation perspective
2) A design should be modular; that is, the software should be logically partitioned
into elements or subsystems
4) A design should lead to data structures that are appropriate for the classes to be
implemented and are drawn from recognizable data patterns
Design Concepts
• Abstraction
• Architecture
– The overall structure of the software and the ways in which the structure
provides conceptual integrity for a system
• Patterns
• Modularity
• Information hiding
– The designing of modules so that the algorithms and local data contained
within them are inaccessible to other modules
• Functional independence
• Stepwise refinement
• Refactoring
• Design classes
• Business domain classes – refined from analysis classes; identify attributes and
services (methods) that are required to implement some element of the business
domain
• Persistent classes – represent data stores (e.g., a database) that will persist
beyond the execution of the software
• Elements of the design model use many of the same UML diagrams used in the
analysis model
– The diagrams
ams are refined and elaborated as part of the design
– More implementation
mplementation-specific detail is provided
– Emphasis is placed on
– Data/class design
– Architectural design
– Interface design
– Component-level design
Design Elements
• Data/class design
• Architectural design
• Interface design
– Tells how information flows into and out of the system and how it is
communicated among the components defined as part of the architecture
• Mature engineering disciplines make use of thousands of design patterns for such
things as buildings, highways, electrical circuits, factories, weapon systems,
vehicles, and computers
• Architectural patterns
• Design patterns
• Coding patterns
Software architecture
Definitions
• Software architectural design represents the structure of the data and program
components that are required to build a computer-based system
• Basic Steps
• A database designer creates the data architecture for a system to represent the
data components
– A program module
– An object-oriented class
– A database
– Middleware
• The software architecture highlights early design decisions that will have a
profound impact on all software engineering work that follows and, as important,
on the ultimate success of the system as an operational entity
• Data design translates data objects defined as part of the analysis model into
• The challenge is to store and retrieve the data in such way that useful information
can be extracted from the data environment
"Data quality is the difference between a data warehouse and a data garbage dump
• The systematic analysis principles that are applied to function and behavior
should also be applied to data
• All data structures and the operations to be performed on each one should be
identified
• A mechanism for defining the content of each data object should be established
and used to define both data and the operations applied to it
• Low-level data design decisions should be deferred until late in the design
process
• A library of useful data structures and the operations that may be applied to them
should be developed
• Data enters the system and then flows through the components one at a time until
they are assigned to output or a data store
• Pipe-and-filter style
– The filters incrementally transform the data (entering and exiting via
streams)
– The filters use little contextual information and retain no state between
instantiations
– The pipes are stateless and simply exist to move data between filters
• Advantages
• Disadvantages
Call-and-Return Style
• Has been the dominant architecture since the start of software development
– Consists of main
in program and subroutine style of system that is
decomposed into parts that are resident on computers connected via a
network
– Emphasizes the bundling of data and how to manipulate and access data
– Keeps the internal data representation hidden and allows access to the
object only through provided operations
• Layered system
– Builds each successive layer on its predecessor, hiding the lower layer and
providing services for the upper layer
• Use this style when the order of computation is fixed, when interfaces are
specific, and when components can make no useful progress while awaiting the
results of request to other components
• Refers to systems in which the access and update of a widely accessed data store
occur
• At its heart is a centralized data store that communicates with a number of clients
• Clients are relatively independent of each other so they can be added, removed,
or changed in functionality
• Note that this style becomes client/server if the clients are modeled as
independent
ent processes
• Software systems in this style simulate some functionality that is not native to the
hardware and/or software on which it is implemented
– Can simulate and test hardware platforms that have not yet been built
• Interpreters
– Add flexibility through the ability to interrupt and query the program and
introduce modifications at runtime
• Use this style when you have developed a program or some form of computation
but have no make of machine to directly run it on
2) Define archetypes
– The identification and flow of all information into and out of a system
• An ACD models the manner in which software interacts with entities external to
its boundaries
– Super-ordinate systems
– Sub-ordinate systems
– Peer-level systems
– Actors
2. Define Archetypes
• Archetypes indicate the important abstractions within the problem domain (i.e.,
they model information)
• An archetype is a class or pattern that represents a core abstraction that is critical
to the design of an architecture for the target system
• It is also an abstraction from a class of programs with a common structure and
includes class-specific design strategies and a collection of example program
designs and implementations
• Only a relatively small set of archetypes is required in order to design even
relatively complex systems
• The target system architecture is composed of these archetypes
– They represent stable elements of the architecture
– They may be instantiated in different ways based on the behavior of the
system
– They can be derived from the analysis class model
The archetypes and their relationships can be illustrated in a UML class diagram
• Node
• Detector/Sensor
• Indicator
• Controller
• Manager
• Moment-Interval
• Role
• Description
• Party, Place, or Thing
Object-oriented View
Conventional View
Process-related View
• Open-closed principle
– A module or component should be open for extension but closed for
modification
– The designer should specify the component in a way that allows it to be
extended without the need to make internal code or design modifications to
the existing parts of the component
• Liskov substitution principle
– Subclasses should be substitutable for their base classes
– A component that uses a base class should continue to function properly if
a subclass of the base class is passed to the component instead
• Dependency inversion principle
– Depend on abstractions (i.e., interfaces); do not depend on concretions
Cohesion
Kinds of cohesion
– Sequential
• Components or operations are grouped in a manner that allows the
first to provide input to the next and so on in order to implement a
sequence of operations
– Procedural
• Components or operations are grouped in a manner that allows one
to be invoked immediately after the preceding one was invoked,
even when no data passed between them
– Temporal
• Operations are grouped to perform a specific behavior or establish a
certain state such as program start-up or when an error is detected
– Utility
• Components, classes, or operations are grouped within the same
category because of similar general functions but are otherwise
unrelated to each other
Coupling
• The kinds of coupling can be ranked in order from lowest (best) to highest
(worst)
– Data coupling
• Operation A() passes one or more atomic data operands to operation
B(); the less the number of operands, the lower the level of coupling
– Stamp coupling
• A whole data structure or class instantiation is passed as a parameter
to an operation
– Control coupling
• Operation A() invokes operation B() and passes a control flag to B
that directs logical flow within B()
• Consequently, a change in B() can require a change to be made to
the meaning of the control flag passed by A(), otherwise an error
may result
– Common coupling
• A number of components all make use of a global variable, which
can lead to uncontrolled error propagation and unforeseen side
effects
– Content coupling
• One component secretly modifies data that is stored internally in
another component
1) List all actions that can be associated with a specific procedure (or module)
2) List all conditions (or decisions made) during execution of the procedure
3) Associate specific sets of conditions with specific actions, eliminating impossible
combinations of conditions; alternatively, develop every possible permutation of
conditions
4) Define rules by indicating what action(s) occurs for a set of conditions
Condition A T T F
Condition B F T
Condition C T T
Actions
Action X
Action Y
Action Z