Week7-System Models
Week7-System Models
Software Design
• The design process comprises a set of principles, concepts and
practices, which allow a software engineer to model the system or
product that is to be built.
• Software design is a phase in software engineering, in which a
blueprint is developed to serve as a base for constructing the
software system.
• Many critical and strategic decisions are made to achieve the desired
functionality and quality of the system.
System Models
• A model is an abstract view of a system that deliberately ignores
some system details.
• Models are used
• during the RE process to help derive the detailed requirements for a system
• during the design process to describe the system to engineers implementing
the system
• after implementation to document the system’s structure and operation.
• A model is an abstraction of the system being studied rather than an
alternative representation of that system. E.g.(this book slides)
System Models
• You may develop different models to represent the system from different perspectives. For
example:
• An external perspective, where you model the context or environment of the system.
• An interaction perspective, where you model the interactions between a system and its
environment, or between the components of a system.
• A structural perspective, where you model the organization of a system or the structure of
the data processed by the system.
• A behavioral perspective, where you model the dynamic behavior of the system and how it
responds to events.
Context Models
• At an early stage in the specification of a system, you should decide
on the system boundaries, that is, on what is and is not part of the
system being developed.
• This involves working with system stakeholders to decide what
functionality should be included in the system and what processing
and operations should be carried out in the system’s operational
environment
• Context models show how a system that is being modeled is
positioned in an environment with other systems and processes. They
help define the boundaries of the system to be developed.
Context Models
Context models normally show that the environment includes several other automated systems. However, they
do not show the types of relationships between the systems in the environment .
Context Models
• All the relationships may affect the requirements and design of the
system being defined and so must be taken into account.
• Simple context models are used along with business process models.
These describe human and automated processes in which particular
software systems are used.
• UML activity diagrams may be used to show the business processes in
which systems are used.
Process Model for Involuntary Detention
Interaction Model
• Modeling system-to-system interaction highlights the communication
problems that may arise. Modeling component interaction helps us
understand if a proposed system structure is likely to deliver the
required system performance and dependability.
• Use case diagrams and sequence diagrams are used to describe the
interactions between users and systems in the system being designed.
• Use cases describe interactions between a system and external
actors; sequence diagrams add more information to these by showing
interactions between system objects.
Use-case Diagram
Use case diagrams give a simple
overview of an interaction, and you
need to add more detail for
complete interaction description.
This detail can either be a simple
textual description, a structured
description in a table, or a sequence
diagram.
Sequence Diagrams
• Sequence diagrams in the UML
are used to model the
interactions between the actors
and the objects in a system and
the interactions between the
objects themselves.
Structural Models
• Structural models show the
organization and architecture of a
system. Class diagrams are used to
define the static structure of classes in
a system and their associations.
• Class diagrams in the UML can be
expressed at different levels of detail.
Whenyou are developing a model, the
first stage is usually to look at the
world, identify the essential objects,
and represent these as classes.
Generalization
• When you are modeling
systems, it is often useful to
examine the classes in a
• system to see if there is scope
for generalization and class
creation. This means
• that common information will
be maintained in one place
only
Aggregation
• Objects in the real world are often made up of different parts. For
example, a study pack for a course may be composed of a book,
PowerPoint slides, quizzes, and recommendations for further reading.
• To define aggregation, a diamond shape is added to the link next to
the class that represents the whole.
Behavioral Models
• Behavioral models are used to describe the dynamic behavior of an
executing system.
• They show what happens or what is supposed to happen when a
system responds to a stimulus from its environment. These stimuli
may be either data or events
• Activity diagrams may be used to model the processing of data,
where each activity represents one process step.
• State diagrams are used to model a system’s behavior in response to
internal or external events.
Data Driven
• Data-driven models show the sequence of actions involved in
processing input data and generating an associated output. They can
be used during the analysis of requirements as they show end-to-end
processing in a system.
Data driven
Using a sequence model for processing an order
and sending it to a supplier.
Sequence models highlight objects in a system,
whereas data-flow diagrams highlight
the operations or activities.
Event Driven
• Event-driven modeling shows how
a system responds to external and
internal events. It is based on the
assumption that a system has a
finite number of states and that
events (stimuli) may cause a
transition from one state to
another.
Model Driven Archictecture
• It is a model-focused approach to software design and
implementation that uses a subset of UML models to describe a
system. Here, models at different levels of abstraction are created,
that can be automatically transformed to executable code.
• The MDA method recommends that three types of abstract system
model should be produced:
• A computation independent model (CIM)
• A platform-independent model (PIM)
• Platform-specific models (PSM)
Analysis Model -> Design Model
21
Quality Guidelines
• A design should exhibit an architecture that (1) has been created using recognizable architectural
styles or patterns, (2) is composed of components that exhibit good design characteristics and (3)
can be implemented in an evolutionary fashion
• For smaller systems, design can sometimes be developed linearly.
• A design should be modular; that is, the software should be logically partitioned into elements or
subsystems
• A design should contain distinct representations of data, architecture, interfaces, and components.
• A design should lead to data structures that are appropriate for the classes to be implemented and
are drawn from recognizable data patterns.
• A design should lead to components that exhibit independent functional characteristics.
• A design should lead to interfaces that reduce the complexity of connections between
components and with the external environment.
• A design should be derived using a repeatable method that is driven by information obtained
during software requirements analysis.
• A design should be represented using a notation that effectively communicates its meaning. 22
Attributes
Hewlett-Packard [Gra87] developed a set of software quality attributes that has been given
the acronym FURPS.
• 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.
• Usability is assessed by considering human factors, overall aesthetics, consistency, and
documentation.
• 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.
• Performance is measured by considering processing speed, response time, resource
consumption, throughput, and efficiency.
• Supportability combines the ability to extend the program (extensibility), adaptability,
serviceability
Design Principles
• The design process should not suffer from ‘tunnel vision.’
• The design should be traceable to the analysis model.
• The design should not reinvent the wheel.
• The design should “minimize the intellectual distance” [DAV95] between the
software and the problem as it exists in the real world.
• The design should exhibit uniformity and integration.
• The design should be structured to accommodate change.
• The design should be structured to degrade gently, even when aberrant data,
events, or operating conditions are encountered.
• Design is not coding, coding is not design.
• The design should be assessed for quality as it is being created, not after the fact.
• The design should be reviewed to minimize conceptual (semantic) errors.
24
Fundamental Concepts
• Abstraction—data, procedure
• Architecture—the overall structure of the software
• Patterns—”conveys the essence” of a proven design solution
• Separation of concerns—any complex problem can be more easily handled if it is
subdivided into pieces
• Modularity—compartmentalization of data and function
• Hiding—controlled interfaces
• Functional independence—single-minded function and low coupling
• Refinement—elaboration of detail for all abstractions
• Aspects—a mechanism for understanding how global requirements affect design
• Refactoring—a reorganization technique that simplifies the design
• OO design concepts—Appendix II
• Design Classes—provide design detail that will enable analysis classes to be implemented
25
Data
Abstraction doo
r
manufacturer
model
typ
number
s
ewing
inserts
direction
light
s
number
type
weigh
o
t pening
mechanism
implemented as a data
structure
26
Procedural
Abstraction open
details of enter
algorith
m
• Monolithic software (i.e., a large program composed of a single module) cannot be easily
grasped by a software engineer.
• In almost all instances, you should break the design into many modules, hoping to make
understanding easier and as a consequence, reduce the cost required to build the
software.
31
Modularity:
Trade-offs
What is the "right" number of modules
for a specific software design?
module development cost
cost of
software
module
integration
cost
33
Functional Independence
Cohesion and Coupling deal with the quality of an OO design.
Generally, good OO design should be loosely coupled and highly
cohesive.
• Cohesion is an indication of the relative functional strength of a module.
• A cohesive module performs a single task, requiring little
interaction with other components in other parts of a program.
• Stated simply, a cohesive module should (ideally) do just one
thing.
34
• Coupling is an indication of the relative interdependence among
modules.
• Coupling depends on the interface complexity between modules, the point
at which entry or reference is made to a module, and what data pass across
the interface.
35
Stepwise
Refinement
open
walk to
reach
door; for
knob;
open repeat until door
door; turn
opens knob
walk if knob doesn't turn,
clockwise;
close
through; thentake key
door. out;find correct
key;insert in
endif
lock;
pull/push door
move out of
way;repeat
end
36
Refactoring
• Fowler [FOW99] 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.”
• When software is refactored, the existing design is examined for
• redundancy
• unused design elements
• inefficient or unnecessary algorithms
• poorly constructed or inappropriate data structures
• or any other design failure that can be corrected to yield a better
design.
37
OO Design Concepts
• Design classes
• Entity classes
• Boundary classes
• Controller classes
• Inheritance—all responsibilities of a superclass is
immediately inherited by all subclasses
• Messages—stimulate some behavior to occur in
the receiving object
• Polymorphism—a characteristic that greatly
reduces the effort required to extend the design
38