Unit 3
Unit 3
Chapter 1: Design
Concepts
▪Design engineering encompasses the set of principles, concepts, and practices that
lead to the development of a high quality system or product.
▪To accomplish this, a designer must practice diversification and then convergence.
⮚ The designer selects from design components, component solutions, and
knowledge available through catalogs, textbooks, and experience.
⮚ The designer then chooses the elements from this collection that meet the
requirements defined by requirements engineering and analysis modeling.
⮚ Convergence occurs as alternatives are considered and rejected until one
particular configuration of components is chosen.
▪Each element of the analysis model provides information that is necessary to
create the four design models.
⮚ The data/class design transforms analysis classes into design classes along with
the data structures required to implement the software.
⮚ The interface design describes how the software communicates with systems that
interoperate with it and with humans that use it.
⮚ The component-level design transforms structural elements of the software
architecture into a procedural description of software components.
What is the work product?
▪A design model that encompasses architectural, interface, component-level, and
deployment representations is the primary work product that is produced during
software design.
The Design Process:
▪Design begins at a high level of abstraction that can be directly traced back to the
data, functional, and behavioral requirements
▪McGlaughlin suggests three characteristics that serve as a guide for the evaluation
of a good design :
1. The design should implement all of the explicit requirements contained in the
requirements model, and it must accommodate all of the implicit requirements
desired by stakeholders.
2. The design should be a readable, understandable guide for those who generate
code and for those who test and subsequently support the software.
3. The design should provide a complete picture of the software, addressing the
data, functional, and behavioral domains from an implementation perspective.
▪How is each of these goals achieved?
Quality Guidelines:
▪In order to evaluate the quality of a design representation, you and other members
of the software team must establish technical criteria for good design.
i. A design should exhibit an architecture that
⮚ Has been created using recognizable architectural styles or patterns.
⮚ Is composed of components that exhibit good design characteristics.
⮚ Can be implemented in an evolutionary fashion, thereby facilitating
implementation and testing.
ii. A design should be modular; that is, the software should be logically partitioned
into elements or subsystems.
iv. A design should lead to data structures that are appropriate for the classes to be
implemented and are drawn from recognizable data patterns.
vi. A design should lead to interfaces that reduce the complexity of connections
between components and with the external environment.
vii. A design should be derived using a repeatable method that is driven by
information obtained during software requirements analysis.
Quality Attributes:
▪The FURPS quality attributes represent a target for all software design:
1. Functionality is assessed by evaluating the feature set and capabilities of the
program, the generality of the functions that are delivered, and the security of the
overall system.
2. Usability is assessed by considering human factors overall aesthetics,
consistency, and documentation.
3. Reliability is evaluated by measuring the frequency and severity of failure, the
accuracy of output results, the mean-time-to-failure (MTTF), the ability to recover
from failure, and the predictability of the program.
4. Performance is measured using processing speed, response time, resource
consumption, throughput, and efficiency.
5. Supportability combines extensibility, adaptability, and serviceability.
(maintainability) and in addition, testability, compatibility, configurability, the ease
with which a system can be installed, and the ease with which problems can be
localized.
The Evolution of Software Design:
▪Each provides the software designer with a foundation from which more
sophisticated design methods can be applied.
▪Each helps:
i. define criteria that can be used to partition software into individual components,
ii. separate or data structure detail from a conceptual representation of the
software, and
iii. establish uniform criteria that define the technical quality of a software design.
1. Abstraction:
▪Different levels of abstraction are developed, you create both procedural and data
abstractions.
▪Procedural abstraction refers to a sequence of instructions that have a specific and
limited function.
▪The name of a procedural abstraction implies these functions, but specific details
are suppressed.
▪An example: open for a door. Open implies a long sequence of procedural steps
(e.g., walk to the door, reach out and grasp knob, turn knob and pull door, step
away from moving door, etc.).
▪In the context of the procedural abstraction open, we can defi ne a data abstraction
called door.
▪Like any data object, the data abstraction for door would encompass a set of
attributes that describe the door (e.g., door type, swing direction, opening
mechanism, weight, dimensions).
▪It follows that the procedural abstraction open would make use of information
contained in the attributes of the data abstraction door.
2. Architecture:
▪Software architecture alludes to “the overall structure of the software and the ways in
which that structure provides conceptual integrity for a system”.
▪The intent of each design pattern is to provide a description that enables a designer
to determine
(1)whether the pattern is applicable to the current work,
(2)whether the pattern can be reused (hence, saving design time), and
(3)whether the pattern can serve as a guide for developing a similar, but functionally
or structurally different pattern.
4. Separation of Concerns:
▪It suggests that any complex problem can be more easily handled if it is
subdivided into pieces that can each be solved and/or optimized independently.
▪Abstraction helps to defi ne the procedural (or informational) entities that make up
the software.
▪Hiding defines and enforces access constraints to both procedural detail within a
module and any local data structure used by the module.
▪The use of information hiding as a design criterion for modular systems provides
the greatest benefits when modifications are required during testing and later
during software maintenance.
7. Functional Independence:
▪Why independence?
⮚ Software with effective modularity is easier to develop because function can be
compartmentalized and interfaces are simplified.
⮚ Independent modules are easier to maintain (and test) because secondary effects
caused by design or code modification are limited.
⮚ Error propagation is reduced, and
⮚ Reusable modules are possible.
▪ A cohesive module performs a single task, requiring little interaction with other
components in other parts of a program.
▪ These concerns:
1. requirements,
2. use cases,
3. features,
4. data structures,
5. Quality of service issues,
6. variants,
7. intellectual property boundaries,
8. collaborations,
9. patterns and contracts
▪As design begins, requirements are refined into a modular design representation.
▪ Fowler defines refactoring in the following manner: “Refactoring is the process of changing
a software system in such a way that it does not alter the external behavior of the code
[design] yet improves its internal structure.”
▪OO design concepts such as classes and objects, inheritance, messages, and
polymorphism, among others.
▪Each of these classes describes some element of the problem domain, focusing on
aspects of the problem that are user visible.
▪Five different types of design classes, each representing a different layer of the
design architecture, can be developed.
i. User interface classes define all abstractions that are necessary for human-
computer interaction (HCI) and often implement the HCI in the context of a
metaphor.
ii. Business domain classes identify the attributes and services (methods) that are
required to implement some element of the business domain that was defined
by one or more analysis classes.
iii. Persistent classes represent data stores (e.g., a database) that will persist beyond
the execution of the software.
iv. System classes implement software management and control functions that
enable the system to operate and communicate within its computing
environment and with the outside world.
▪Contains only those methods that are sufficient to achieve the intent of the class
Ex: class Scene and all attributes and methods.
ii. Primitiveness.
▪Each method of a class focuses on accomplishing one service for the class
Ex: the class VideoClip for video editing software might have attributes and to
indicate the start and end points of the clip. The methods, setStart-Point() and
setEndPoint(), provide the only means for establishing start and end points for the
clip.
iii. High cohesion.
▪The class has a small, focused set of responsibilities and single-mindedly applies
attributes and methods to implement those responsibilities
▪For example, the class VideoClip might contain a set of methods for editing the
video clip. As long as each method focuses solely on attributes associated with the
video clip, cohesion is maintained.
▪Each class should have limited knowledge of other classes in other subsystems
▪The restriction – the Law of Demeter suggests that a method should only send
messages to methods in neighboring classes.
13. Dependency Inversion
▪The structure of many older software architectures is hierarchical.
▪At the top of the architecture, “control” components rely on lower-level “worker”
components to perform various cohesive tasks.
▪Consider a simple program with three components. The intent of the program is
to read keyboard strokes and then print the result to a printer.
▪These abstract classes could then be used to invoke worker classes that perform
any read and write function.
▪Therefore a copy class, C, invokes abstract classes, R* and W*, and the abstract
class points to the appropriate worker-class (e.g., the R* class might point to a
read() operation within a keyboard class in one context and a read() operation
within a sensor class in another.
▪ This approach reduces coupling and improves the testability of a design.
▪ There is an ongoing chicken-and-egg debate about whether software design or test case
design should come first.
▪ But if design comes first, then the design (and code) must be developed with seams —
locations in the detailed design.
▪ In short, you need to provide appropriate test affordances—factoring your design in a way
that lets test code interrogate and control the running system.
The Design Model:
▪The design model can be viewed in two different dimensions: Process and
Abstraction dimension.
▪The process dimension indicates the evolution of the design model as design tasks
are executed as part of the software process.
▪The abstraction dimension represents the level of detail as each element of the
analysis model is transformed into a design equivalent and then refined iteratively.
Data Design Elements:
▪Like other software engineering activities, data design creates a model of data
and/or information that is represented at a high level of abstraction.
▪Importance of the architecture of the data - architecture of the software that must
process it.
▪At the application level, the translation of a data model into a database is pivotal
to achieving the business objectives of a system.
▪At the business level, the collection of information stored in disparate databases
and reorganized into a “data warehouse” enables data mining or knowledge
discovery that can have an impact on the success of the business itself.
Architectural Design Elements:
▪The architectural design for software is the equivalent to the floor plan of a house.
▪The floor plan depicts the overall layout of the rooms; their size, shape, and
relationship to one another; and the doors and windows that allow movement into
and out of the rooms.
▪The interface design elements for software depict information flows into and out
of a system and how it is communicated among the components defined as part of
the architecture.
▪UI design (also called usability design ) is a major software engineering action.
▪Design realizations of analysis classes represent all operations and the messaging
schemes required to enable communication and collaboration between operations
in various classes.
▪The component-level design for software fully describes the internal detail of each
software component.
▪To accomplish this, the component-level design defines data structures for all local
data objects and algorithmic detail for all processing that occurs within a
component and an interface that allows access to all component operations
(behaviours).
▪Within the context of object-oriented software engineering, a component is
represented in UML diagrammatic form as shown in Figure:
▪The design details of a component can be modeled at many different levels of
abstraction.
i. A UML activity diagram can be used to represent processing logic.
ii. Detailed procedural flow for a component can be represented using either
pseudocode or some other diagrammatic form (e.g., flowchart or box diagram).
▪Data structures, selected based on the nature of the data objects to be processed,
are usually modeled using pseudocode or the programming language to be used
for implementation.
Deployment-Level Design Elements:
▪Ex: For example, the elements of the SafeHome product are configured to operate
within three primary computing environments—a homebased PC, the SafeHome
control panel, and a server housed at CPI Corp. (providing Internet-based access to
the system).
▪During design, a UML deployment diagram is developed and then refined
as shown in Figure:
▪Descriptor form- the deployment diagram shows the computing environment but
does not explicitly indicate configuration details.
▪These details are provided when the deployment diagram is revisited in instance
form during the latter stages of design or as construction begins.
Chapter 2:
Architectural Design
What is Architecture Design!
▪Bass, Clements, and Kazman define this elusive term in the following way:
“The software architecture of a program or computing system is the
structure or structures of the system, which comprise software components, the
externally visible properties of those components, and the relationships among
them”.
▪The architecture is not the operational software. Rather, it is a representation that
enables a software engineer to:
(1) analyze the effectiveness of the design in meeting its stated requirements,
(2) consider architectural alternatives at a stage when making design changes is still
relatively easy, and
▪The 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-centered architectures
▪ Data flow architectures
▪ Call and return architectures
▪ Object-oriented architectures
▪ Layered architectures
Data-Centered Architecture:
▪A data store (e.g., a file or database) resides at the center of this architecture and is
accessed frequently by other components that update, add, delete, or otherwise
modify data within the store.
▪ Client software accesses a central repository. In some cases the data repository is
passive. That is, client software accesses the data independent of any changes to
the data or the actions of other client software.
▪In addition, data can be passed among clients using the blackboard mechanism
(i.e., the blackboard component serves to coordinate the transfer of information
between clients). Client components independently execute processes.
Data-flow architectures:
▪This architecture is applied when input data are to be transformed through a series
of computational or manipulative components into output data.
▪If the data flow degenerates into a single line of transforms, it is termed batch
sequential.
▪This structure accepts a batch of data and then applies a series of sequential
components (filters) to transform it.
Call and return architectures:
This architectural style enables you to achieve a program structure that is
relatively easy to modify and scale. A number of substyles exist within this
category:
▪The components of a system encapsulate data and the operations that must be
applied to manipulate the data.
▪For example, the requirements model for virtually every e-commerce application
is faced with the following problem:
i. How do we offer a broad array of goods to many different customers and allow
those customers to purchase our goods online?
▪The requirements model also defines a context in which this question must
be answered.
▪For example, an e-commerce business that sells golf equipment to consumers will
operate in a different context than an e-commerce business that sells high-priced
industrial equipment to medium and large corporations.
▪In addition, a set of limitations and constraints may affect the way you address the
problem to be solved.
▪The pattern proposes an architectural solution that can serve as the basis for
architectural design.
Organization and Refinement:
▪The design process often leaves you with a number of architectural alternatives, it
is important to establish a set of design criteria that can be used to assess an
architectural design that is derived.
▪To accomplish this, the external entities (e.g., other systems, devices, people) that
interact with the software and the nature of their interaction are described.
▪Once context is modelled and all external software interfaces have been described,
you can identify a set of architectural archetypes.
▪An archetype is an abstraction (similar to a class) that represents one element of
system behavior.
▪The designer specifies the structure of the system by defining and refining
software components that implement each archetype.
▪This process continues iteratively until a complete architectural structure has been
derived.
Representing the System in Context:
▪At the architectural design level, a software architect uses an architectural context
diagram (ACD) to model the manner in which software interacts with entities
external to its boundaries.
▪Superordinate systems —those systems that use the target system as part of some
higher-level processing scheme.
▪Subordinate systems —those systems that are used by the target system and
provide data or processing that are necessary to complete target system
functionality.
▪Actors —entities (people, devices) that interact with the target system by
producing or consuming information that is necessary for requisite processing.
▪Each of these external entities communicates with the target system through an
interface (the small shaded rectangles).
Defining Archetypes:
▪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.
▪In many cases, archetypes can be derived by examining the analysis classes
defined as part of the requirements model.
▪The design of SafeHome home security function, the following archetypes are
defined:
▪Node. Represents a cohesive collection of input and output elements of the home
security function. For example, a node might be composed of
(1) various sensors and
(2) a variety of alarm (output) indicators.
▪Detector. An abstraction that encompasses all sensing equipment that feeds
information into the target system.
▪Indicator. An abstraction that represents all mechanisms (e.g., alarm siren,
flashing lights, bell) for indicating that an alarm condition is occurring.
▪Controller. An abstraction that depicts the mechanism that allows the arming or
disarming of a node. If controllers reside on a network, they have the ability to
communicate with one another.
Refining the Architecture into Components:
▪A UML class diagram can represent the classes of the refined architecture and
their relationships.
Functionality:
-External communication management
-Control panel processing
-Detector management
-alarm processing
Describing Instantiations of the System:
▪The architectural design that has been modeled to this point is still relatively high
level.
▪The context of the system has been represented, archetypes that indicate the
important abstractions within the problem domain have been defined, the overall
structure of the system is apparent, and the major software components have been
identified.
▪One more thing to do - further refinement (recall that all design is iterative) is still
necessary.
▪To accomplish this, an actual instantiation of the architecture is developed.
▪An architect will examine requirements for security and usability to determine
which features should be allocated to the client or server.
▪The architectural design of a WebApp is also influenced by the structure (linear or
nonlinear) of the content that needs to be accessed by the client.
▪The physical location of media and other content resources also influences the
architectural choices made by software engineers.
Architectural Design for Mobile Apps:
▪With mobile apps you have the choice of building a thin Web-based client or a
rich client.
▪With a thin client, only the user interface resides on the mobile device, whereas
the business and data layers reside on a server.
▪With a rich client all three layers may reside on the mobile device itself.
▪Each of these attributes shapes the direction of the architectural alternatives that
can be selected.
▪A number of considerations that can influence the architectural design of a mobile
app:
▪The component-level design represents the software in a way that allows you to
review the details of the design for correctness and consistency with other design
representations (i.e., the data, architectural, and interface designs).
▪It provides a means for assessing whether data structures, interfaces, and
algorithms will work.
What is the work product?
1. An Object-oriented view
▪In a context of OO software engineering, a component contains a set of
collaborating classes.
▪Each class within a component has been fully elaborated to include all attributes
and operations that are relevant to its implementation.
▪As a part of the design elaboration, all interfaces that enable the classes to
communicate and collaborate with other design classes must be defined
▪Ex: To illustrate this process of design elaboration, consider software to be built
for a sophisticated print shop.
▪The overall intent of the software is to collect the customer’s requirements at the
front counter, cost a print job, and then pass the job on to an automated production
facility.
▪The attributes and operations defined during analysis are noted at the top of
Figure.
▪The original analysis class is elaborated to flesh out all attributes and operations
required to implement the class as the component PrintJob.
▪Referring to the lower right portion of Figure the elaborated design class PrintJob
contains more detailed attribute information as well as an expanded description of
operations required to implement the component.
▪The interfaces compute-Job and initiateJob imply communication and
collaboration with other components.
⮚An infrastructure component that is responsible for the functions that support
the processing required in the problem domain.
▪Like object-oriented components, traditional software components are derived
from the analysis model.
▪In this case, however, the component elaboration element of the analysis model
serves as the basis for the derivation.
▪Control components (modules) reside near the top of the hierarchy (program
architecture), and problem domain components tend to reside toward the bottom of
the hierarchy.
▪To achieve effective modularity, design concepts like functional independence are
applied as components are elaborated.
3. A Process-Related View
▪The detailed description of the attributes, operations, and interfaces used by these
classes is the design detail required as a precursor to the construction activity.
Designing Class-Based Components:
▪The Open-Closed Principle (OCP) : “A module should be open for extension but
closed for modification”. The component should be extended without the need to
make internal modifications (logic level / code) to the component itself.
▪The Release Reuse Equivalency Principle (REP): “The granule of reuse is the
granule of release.” It is advisable to group reusable classes into packages that can
be managed and controlled as newer versions evolve
▪The Common Closure Principle (CCP) : “Classes that change together belong
together.” When classes are packaged as a part of a design, they should address the
same functional or behavioral area. (classes should be packaged cohesively)
▪The Common Reuse Principle (CRP) : “Classes that aren’t reused together
should not be grouped together.” So only classes that are reused together should
be included within a package
Component-Level Design Guidelines:
▪Component
▪Naming conventions
▪Interfaces
▪Only those interfaces that are relevant to the component under consideration
should be shown.
▪Dependencies and Inheritance
▪Dependencies should be modeled from left to right and inheritance should be
modeled from bottom to top.
Cohesion:
▪Singlemindedness.
▪ Types of cohesion
▪ Functional : Exhibited by operations, this level of cohesion occurs when a
component performs a targeted computation and then returns a result
▪ Layer : Exhibited by packages, components, and classes, this type of
cohesion occurs when higher layer accesses the services of a lower layer but
lower layer do not access higher level
▪ Communicational: All the operations that access the same data are defined
within one class. Such classes focus on the data in question, accessing and
storing it.
Coupling:
▪Coupling is a qualitative measure of the degree to which classes are connected to
one another.
▪Coupling categories:
▪Content coupling: Occurs when one component modifies data that is internal to
another component (violates information hiding)
▪Common coupling: Occurs when a number of components all make use of a
global variable
▪Control coupling: Occurs when operation A() invokes operation B() and passes
control flag to B
▪Stamp coupling: Occurs when class B is declared as a type for an argument of
an operation of class A
▪Data coupling: Occurs when operations pass long strings of data arguments
▪Routine call coupling: Occurs when one operation invokes another
▪Type use coupling: Occurs when component A uses a data type defined in component B
▪Inclusion or import coupling: Occurs when component A imports or includes a
package or content of component B.
▪External coupling: Occurs when a component communicates or collaborates
with infrastructure components (O.S functions, telecommunication function).
Conducting Component-level Design:
Step 1. Identify all design classes that correspond to the problem domain. Using
the requirements and architectural model, each analysis class and architectural
component is elaborated.
Step 2. Identify all design classes that correspond to the infrastructure domain.
▪Classes and components in this category include GUI components (often available
as reusable components), operating system components, and object and data
management components.
Step 3. Elaborate all design classes that are not acquired as reusable
components.
▪Elaboration requires that all interfaces, attributes, and operations necessary to
implement the class be described in detail.
Step 3c. Elaborate attributes and define data types and data structures
required to implement them.
▪UML defines an attribute’s data type using the following syntax:
name : type-expression 5 initial-value {property string}
▪where
i. name is the attribute name,
ii. type expression is the data type, initial value is the value that the attribute takes
when an object is created, and
iii. property-string defines a property or characteristic of the attribute.
Step 3d. Describe processing flow within each operation in detail.
▪This may be accomplished using a programming language-based pseudocode or
with a UML activity diagram.
Step 4. Describe persistent data sources (databases and files) and identify the
classes required to manage them.