Chapter 7 – Design and Implementation
30/10/2014 Chapter 7 Design and Implementation 1
Topics covered
understand the most important activities in a general,
object-oriented design process;
understand some of the different models that may be
used to document an object-oriented design;
know about the idea of design patterns and how these
are a way of reusing design knowledge and experience;
have been introduced to key issues that have to be
considered when implementing software, including
software reuse.
30/10/2014 Chapter 7 Design and Implementation 2
Design and implementation
Software design and implementation is the stage in the
software engineering process at which an executable
software system is developed.
Software design and implementation activities are
invariably inter-leaved.
Software design is a creative activity in which you identify
software components and their relationships, based on a
customer’s requirements.
Implementation is the process of realizing the design as a
program.
30/10/2014 Chapter 7 Design and Implementation 3
Build or buy
In a wide range of domains, it is now possible to buy off-
the-shelf systems (COTS) that can be adapted and
tailored to the users’ requirements.
For example, if you want to implement a medical records
system, you can buy a package that is already used in hospitals.
It can be cheaper and faster to use this approach rather than
developing a system in a conventional programming language.
When you develop an application in this way, the design
process becomes concerned with how to use the
configuration features of that system to deliver the
system requirements.
30/10/2014 Chapter 7 Design and Implementation 4
Object-oriented design using the UML
30/10/2014 Chapter 7 Design and Implementation 5
An object-oriented design process
An object-oriented system is made up of interacting
objects that maintain their own local state and provide
operations on that state.
Object-oriented design processes involve designing
object classes and the relationships between these
classes
Objects include both data and operations to manipulate
that data. They may therefore be understood and
modified as stand-alone entities. Changing the
implementation of an object or adding services should
not affect other system objects.
30/10/2014 Chapter 7 Design and Implementation 6
An object-oriented design process
Structured object-oriented design processes involve
developing a number of different system models.
They require a lot of effort for development and
maintenance of these models and, for small systems,
this may not be cost-effective.
However, for large systems developed by different
groups design models are an important communication
mechanism.
30/10/2014 Chapter 7 Design and Implementation 7
Process stages
To develop a system design from concept to detailed,
object-oriented design:
Common activities in these processes include:
Define the context and modes of use of the system;
Design the system architecture;
Identify the principal system objects;
Develop design models;
Specify object interfaces.
Process illustrated here using a design part of
embedded software for a wilderness weather station.
30/10/2014 Chapter 7 Design and Implementation 8
System context and interactions
System context models and interaction models
present complementary views of the relationships
between a system and its environment:
A system context model is a structural model that
demonstrates the other systems in the environment
of the system being developed.
An interaction model is a dynamic model that shows
how the system interacts with its environment as it is
used.
30/10/2014 Chapter 7 Design and Implementation 9
System context and interactions
Understanding the relationships between the software
that is being designed and its external environment is
essential for deciding how to provide the required system
functionality and how to structure the system to
communicate with its environment.
Understanding of the context also lets you establish the
boundaries of the system. Setting the system boundaries
helps you decide what features are implemented in the
system being designed and what features are in other
associated systems.
30/10/2014 Chapter 7 Design and Implementation 10
Context models
The context model of a system may be represented
using associations
Associations simply show that there are some
relationships between the entities involved in the
association.
You can document the environment of the system using
a simple block diagram, showing the entities in the
system and their association
30/10/2014 Chapter 7 Design and Implementation 11
System context for the weather station
Wilderness weather stations are deployed in remote areas.
Each weather station records local weather information and periodically transfers
this to a weather information system, using a satellite link.
30/10/2014 Chapter 7 Design and Implementation 12
Weather station use cases
TASKS
Report weather–send weather data to
the weather information system
Report status–send status information
to the weather information system
Restart–if the weather station is shut
down, restart the system
Shutdown–shut down the weather
station
Reconfigure–reconfigure the weather
station software
Powersave–put the weather station into
power-saving mode
Remote control–send control
commands to any weather station
subsystem
30/10/2014 Chapter 7 Design and Implementation 13
Use case description—Report weather
System Weather station
Use case Report weather
Actors Weather information system, Weather station
Description The weather station sends a summary of the weather data that has been
collected from the instruments in the collection period to the weather
information system. The data sent are the maximum, minimum, and average
ground and air temperatures; the maximum, minimum, and average air
pressures; the maximum, minimum, and average wind speeds; the total
rainfall; and the wind direction as sampled at five-minute intervals.
Stimulus The weather information system establishes a satellite communication link
with the weather station and requests transmission of the data.
Response The summarized data is sent to the weather information system.
Comments Weather stations are usually asked to report once per hour but this frequency
may differ from one station to another and may be modified in the future.
30/10/2014 Chapter 7 Design and Implementation 14
Architectural design
Once interactions between the system and its
environment have been understood, you use this
information for designing the system architecture.
You identify the major components that make up the
system and their interactions, and then may organize the
components using an architectural pattern such as a
layered or client-server model.
The weather station is composed of independent
subsystems (Layered Arc.) that communicate by
broadcasting messages on a common infrastructure.
30/10/2014 Chapter 7 Design and Implementation 15
High-level architecture of the weather station
Each subsystem listens for messages on that infrastructure and picks up the
messages that are intended for them.
This “listener model” is a commonly used architectural style for distributed
systems.
30/10/2014 Chapter 7 Design and Implementation 16
High-level architecture of the weather station
The key benefit of this architecture is that it is easy to support different
configurations of
subsystems because the sender of a message does not need to address the
message to a particular subsystem.
30/10/2014 Chapter 7 Design and Implementation 17
Architecture of data collection system
The Transmitter and Receiver objects are concerned with
managing communications
WeatherData object encapsulates the information that is collected
from the instruments and transmitted to the weather information
system.
30/10/2014 Chapter 7 Design and Implementation 18
Object class identification
You should have some ideas about the essential objects
in the system that you are [Link] refine these
ideas about the system objects.
Use case description helps to identify objects and
operations in the system.
From the description of the Report weather use case, it
is obvious that you will need to implement objects
representing the instruments that collect weather data
and an object representing the ‐ summary of the weather
data
30/10/2014 Chapter 7 Design and Implementation 19
Object class identification
Identifying object classes is often a difficult part of object
oriented design.
There is no 'magic formula' for object identification. It
relies on the skill, experience
and domain knowledge of system designers.
Object identification is an iterative process. You are
unlikely to get it right first time.
30/10/2014 Chapter 7 Design and Implementation 20
Approaches to identification
Use a grammatical approach based on a natural
language description of the system. (Objects and attributes
are nouns; operations or services are verbs)
Base the identification on tangible things in the
application domain.(such as aircraft, roles such as manager,
events such as request, locations)
Use a scenario-based analysis. The objects, attributes
and methods in each scenario are identified.
30/10/2014 Chapter 7 Design and Implementation 21
Weather station object classes
Object class identification (identified from the system
description and the scenario (use case) in the weather
station system may be based on the tangible hardware
and data in the system:
Ground thermometer, Anemometer, Barometer
• Application domain objects that are ‘hardware’ objects related to the
instruments in the system.
Weather station
• The basic interface of the weather station to its environment. It
therefore reflects the interactions identified in the use-case model.
Weather data
• Encapsulates the summarized data from the instruments.
30/10/2014 Chapter 7 Design and Implementation 22
Weather station object classes
The WeatherStation object class
provides the basic interface of the
weather station with its environment
30/10/2014 Chapter 7 Design and Implementation 23
Weather station object classes
sends the summarized data from the weather
station instruments to the weather information
system.
30/10/2014 Chapter 7 Design and Implementation 24
Weather station object classes
directly related to instruments in the system.
bjects operate autonomously collect data at
the specified frequency and store the collected
30/10/2014
data [Link] 7 Design and Implementation 25
Design models
Design models show the objects and object classes and
relationships between these entities.
These models are the bridge between the system
requirements and the implementation of a system.
They also have to include enough detail for
programmers to make implementation decisions.
There are two kinds of design model:
Structural models describe the static structure of the system in
terms of object classes and relationships.
Dynamic models describe the dynamic interactions between
objects.
30/10/2014 Chapter 7 Design and Implementation 26
Examples of design models
Three UML model types are particularly useful for
adding detail to use case and architectural models:
Subsystem models (Structured) that show logical
groupings of objects into coherent subsystems. (class
diagram )
Sequence models (Dynamic) that show the sequence
of object interactions.
State machine models (Dynamic) that show how
individual objects change their state in response to
events.
30/10/2014 Chapter 7 Design and Implementation 27
Subsystem models
Shows how the design is organised into logically
related groups of objects.
In the UML, these are shown using packages - an
encapsulation construct. This is a logical model. The
actual organisation of objects in the system may be
different.
30/10/2014 Chapter 7 Design and Implementation 28
Sequence models
Sequence models show the sequence of object
interactions that take place
Objects are arranged horizontally across the top;
Time is represented vertically so models are read top to bottom;
Interactions are represented by labelled arrows, Different styles
of arrow represent different types of interaction;
A thin rectangle in an object lifeline represents the time when the
object is the controlling object in the system.
30/10/2014 Chapter 7 Design and Implementation 29
Sequence diagram describing data collection
30/10/2014 Chapter 7 Design and Implementation 30
Sequence diagram describing data collection
The SatComms object receives a request
from the weather information system to
collect a weather report from a weather
30/10/2014 station Chapter 7 Design and Implementation 31
Sequence diagram describing data collection
SatComms sends a message to
WeatherStation, via a satellite link, to create a
summary of the collected weather data.
30/10/2014 Chapter 7 Design and Implementation 32
Sequence diagram describing data collection
WeatherStation sends a message to a
Commslink object to summarize the weather
data.
30/10/2014 Chapter 7 Design and Implementation 33
Sequence diagram describing data collection
Commslink calls the summarize method in the object WeatherData and
waits for a reply.
The weather data summary is computed and returned to
WeatherStation via the Commslink object.
30/10/2014 Chapter 7 Design and Implementation 34
Sequence diagram describing data collection
WeatherStation then calls the SatComms object to transmit the summarized data to
the weather information system, through the satellite communications system.
30/10/2014 Chapter 7 Design and Implementation 35
State diagrams
State diagrams are used to show how objects respond to
different service requests and the state transitions
triggered by these requests.
State diagrams are useful high-level models of a system
or an object’s run-time behavior.
You don’t usually need a state diagram for all of the
objects in the system.
Many of the objects in a system are relatively simple and
a state model adds unnecessary detail to the design.
30/10/2014 Chapter 7 Design and Implementation 36
Weather station state diagram
30/10/2014 Chapter 7 Design and Implementation 37
Interface specification
An important part of any design process is the
specification of the interfaces between the components
in the design.
You need to specify interfaces so that objects and
subsystems can be designed in parallel.
You should not include details of the data representation
in an interface design, as attributes are not defined in an
interface specification
30/10/2014 Chapter 7 Design and Implementation 38
Interface specification
Objects may have several interfaces which are
viewpoints on the methods provided.
The UML uses class diagrams for interface
specification but Java may also be used.
30/10/2014 Chapter 7 Design and Implementation 39
Weather station interfaces
defines the operation
names that are used to generate weather and
status reports
4 operations mapped to remoteControl()
30/10/2014 Chapter 7 Design and Implementation 40
Design patterns
30/10/2014 Chapter 7 Design and Implementation 41
Design patterns
A design pattern is a way of reusing abstract knowledge
about a problem and its solution.
It should be sufficiently abstract to be reused in different
settings.
Pattern descriptions usually make use of object-oriented
characteristics such as inheritance and polymorphism.
30/10/2014 Chapter 7 Design and Implementation 42
Design patterns
Patterns are a way of reusing the knowledge and
experience of other designers.
Design patterns are usually associated with object-
oriented design.
You could have configuration patterns for instantiating
reusable application systems.
30/10/2014 Chapter 7 Design and Implementation 43
Pattern elements
Name
A meaningful pattern identifier.
Problem description (when the pattern may be applied).
Solution description.
Not a concrete design but a template for a design solution that
can be instantiated in different ways. (mostly graphically)
Consequences
The results and trade-offs of applying the pattern.
30/10/2014 Chapter 7 Design and Implementation 44
Implementation issues
30/10/2014 Chapter 7 Design and Implementation 45
Implementation issues
A criticial stage is system implementation, where you
create an executable version of the software.
Implementation may involve developing programs in
high- or low-level programming languages or tailoring
and adapting generic, off-the-shelf systems to meet the
specific requirements of an organization.
30/10/2014 Chapter 7 Design and Implementation 46
Implementation issues
Focus here is not on programming, although this is
obviously important, but on other implementation issues
that are often not covered in programming texts:
Reuse Most modern software is constructed by reusing existing
components or systems. When you are developing software,
you should make as much use as possible of existing code.
Configuration management During the development process,
you have to keep track of the many different versions of each
software component in a configuration management system.
Host-target development Production software does not usually
execute on the same computer as the software development
environment. Rather, you develop it on one computer (the host
system) and execute it on a separate computer (the target
system).
30/10/2014 Chapter 7 Design and Implementation 47
Reuse
From the 1960s to the 1990s, most new software was
developed from scratch, by writing all code in a high-
level programming language.
The only significant reuse or software was the reuse of functions
and objects in programming language libraries.
Costs and schedule pressure mean that this approach
became increasingly unviable, especially for commercial
and Internet-based systems.
An approach to development based around the reuse of
existing software emerged and is now generally used for
business and scientific software.
30/10/2014 Chapter 7 Design and Implementation 48
Reuse levels
The abstraction level
At this level, you don’t reuse software directly but use knowledge
of successful abstractions in the design of your software.
The object level
At this level, you directly reuse objects from a library rather than
writing the code yourself.(JavaMail library. )
The component level
Components are collections of objects and object classes that
you reuse in application systems.
The system level
At this level, you reuse entire application systems.
30/10/2014 Chapter 7 Design and Implementation 49
Software reuse
30/10/2014 Chapter 7 Design and Implementation 50
Reuse costs
The costs of the time spent in looking for software to
reuse and assessing whether or not it meets your needs.
Where applicable, the costs of buying the reusable
software. For large off-the-shelf systems, these costs
can be very high.
The costs of adapting and configuring the reusable
software components or systems to reflect the
requirements of the system that you are developing.
The costs of integrating reusable software elements
with each other (if you are using software from different
sources) and with the new code that you have
developed.
30/10/2014 Chapter 7 Design and Implementation 51
Configuration management
Software development, change happens all the time, so change
management is absolutely essential.
When several people are involved in developing a software system,
you have to make sure that team members don’t interfere with each
other’s work.
That is, if two people are working on a component, their changes
have to be coordinated. Otherwise, one programmer may make
changes and overwrite the other’s work.
You also have to ensure that everyone can access the most up-to-
date versions of software components; otherwise developers may
redo work that has already been done.
30/10/2014 Chapter 7 Design and Implementation 52
Configuration management
Configuration management is the name given to the
general process of managing a changing software
system.
The aim of configuration management is to support the
system integration process so that all developers can
access the project code and documents in a controlled
way, find out what changes have been made, and
compile and link components to create a system.
30/10/2014 Chapter 7 Design and Implementation 53
Configuration management activities
Version management, where support is provided to keep
track of the different versions of software components. Version
management systems include facilities to coordinate
development by several programmers.
System integration, where support is provided to help
developers define what versions of components are used to
create each version of a system. This description is then used
to build a system automatically by compiling and linking the
required components.
30/10/2014 Chapter 7 Design and Implementation 54
Configuration management activities
Problem tracking, where support is provided to allow users
to report bugs and other problems, and to allow all developers
to see who is working on these problems and when they are
fixed.
Release management, where new versions of a software
system are released to customers. Release management is
concerned with planning the functionality of new releases and
organizing the software for distribution.
30/10/2014 Chapter 7 Design and Implementation 55
Configuration management tool interaction
30/10/2014 Chapter 7 Design and Implementation 56
Host-target development
Most software is developed on one computer (the host),
but runs on a separate machine (the target).
More generally, we can talk about a development
platform and an execution platform.
A platform is more than just hardware.
It includes the installed operating system plus other supporting
software such as a database management system or, for
development platforms, an interactive development environment.
Development platform usually has different installed
software than execution platform; these platforms may
have different architectures.
30/10/2014 Chapter 7 Design and Implementation 57
Host-target development
30/10/2014 Chapter 7 Design and Implementation 58
Host-target development
Sometimes, the development platform and execution
platform are the same, making it possible to develop the
software and test it on the same machine.
Therefore, if you develop in Java, the target environment
is the Java Virtual Machine.
In principle, this is the same on every computer, so
programs should be portable from one machine to
another.
However, particularly for embedded systems and
mobile systems, the development and the execution
platforms are different.
30/10/2014 Chapter 7 Design and Implementation 59
Host-target development
You need to either move your developed software to the
execution platform for testing or run a simulator on your
development machine.
Simulators are often used when developing embedded
systems. You simulate hardware devices, such as
sensors, and the events in the environment in which the
system will be deployed.
Simulators speed up the development
However, simulators are expensive to develop and so
are usually available only for the most popular hardware
architectures.
30/10/2014 Chapter 7 Design and Implementation 60
Host-target development
You need to either move your developed software to the
execution platform for testing or run a simulator on your
development machine.
Simulators are often used when developing embedded
systems. You simulate hardware devices, such as
sensors, and the events in the environment in which the
system will be deployed.
Simulators speed up the development
However, simulators are expensive to develop and so
are usually available only for the most popular hardware
architectures.
30/10/2014 Chapter 7 Design and Implementation 61
Development platform tools
Software development tools are now usually installed
within an integrated development environment (IDE).
An IDE is a set of software tools that supports different
aspects of software development within some common
framework and user interface.
Generally, IDEs are created to support development in a
specific programming language such as Java.
A general-purpose IDE is a framework for hosting
software tools general-purpose IDE is the Eclipse
environment
30/10/2014 Chapter 7 Design and Implementation 62
Development platform tools
An integrated compiler and syntax-directed editing
system that allows you to create, edit and compile code.
A language debugging system.
Graphical editing tools, such as tools to edit UML
models.
Testing tools, such as Junit that can automatically run a
set of tests on a new version of a program.
Project support tools that help you organize the code for
different development projects.
30/10/2014 Chapter 7 Design and Implementation 63