Design and implementation Build or buy
Software design and implementation is the stage in the In a wide range of domains, it is now possible to buy off-
software engineering process at which an executable the-shelf systems (COTS) that can be adapted and
software system is developed. tailored to the users’ requirements.
Software design and implementation activities are ▪ For example, if you want to implement a medical records system,
you can buy a package that is already used in hospitals. It can
invariably inter-leaved.
be cheaper and faster to use this approach rather than
▪ Software design is a creative activity in which you identify developing a system in a conventional programming language.
software components and their relationships, based on a
customer’s requirements. When you develop an application in this way, the design
▪ Implementation is the process of realizing the design as a process becomes concerned with how to use the
program. configuration features of that system to deliver the
system requirements.
30/10/2014 Chapter 7 Design and Implementation 3 30/10/2014 Chapter 7 Design and Implementation 4
Process stages System context and interactions
There are a variety of different object-oriented design Understanding the relationships between the software
processes that depend on the organization using the that is being designed and its external environment is
process. essential for deciding how to provide the required system
Common activities in these processes include: functionality and how to structure the system to
communicate with its environment.
▪ Define the context and modes of use of the system;
▪ Design the system architecture; Understanding of the context also lets you establish the
▪ Identify the principal system objects; boundaries of the system. Setting the system boundaries
▪ Develop design models; helps you decide what features are implemented in the
▪ Specify object interfaces. system being designed and what features are in other
associated systems.
Process illustrated here using a design for a wilderness
weather station.
30/10/2014 Chapter 7 Design and Implementation 7 30/10/2014 Chapter 7 Design and Implementation 8
Context and interaction models System context for the weather station
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 30/10/2014 Chapter 7 Design and Implementation 10
Weather station use cases 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 11 30/10/2014 Chapter 7 Design and Implementation 12
Architectural design Object class identification
Once interactions between the system and its Identifying object classes is often a difficult part of object
environment have been understood, you use this oriented design.
information for designing the system architecture. There is no 'magic formula' for object identification. It
You identify the major components that make up the relies on the skill, experience
system and their interactions, and then may organize the and domain knowledge of system designers.
components using an architectural pattern such as a Object identification is an iterative process. You are
layered or client-server model. unlikely to get it right first time.
The weather station is composed of independent
subsystems that communicate by broadcasting
messages on a common infrastructure.
30/10/2014 Chapter 7 Design and Implementation 13 30/10/2014 Chapter 7 Design and Implementation 16
Weather station object classes Design models
Design models show the objects and object classes and
relationships between these entities.
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 19 30/10/2014 Chapter 7 Design and Implementation 20
Sequence diagram describing data collection Weather station state diagram
30/10/2014 Chapter 7 Design and Implementation 24 30/10/2014 Chapter 7 Design and Implementation 26
Design patterns Patterns
A design pattern is a way of reusing abstract knowledge Patterns and Pattern Languages are ways to describe
about a problem and its solution. best practices, good designs, and capture experience in
a way that it is possible for others to reuse this
A pattern is a description of the problem and the essence
experience.
of 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 30 30/10/2014 Chapter 7 Design and Implementation 31
The Observer pattern (1)
The Observer pattern
Name
Pattern Observer
▪ Observer. name
Description Description Separates the display of the state of an object from the object itself and
allows alternative displays to be provided. When the object state
▪ Separates the display of object state from the object itself. changes, all displays are automatically notified and updated to reflect the
Problem description change.
Problem In many situations, you have to provide multiple displays of state
▪ Used when multiple displays of state are needed.
description information, such as a graphical display and a tabular display. Not all of
Solution description these may be known when the information is specified. All alternative
presentations should support interaction and, when the state is changed,
▪ See slide with UML description. all displays must be updated.
Consequences This pattern may be used in all situations where more than one
display format for state information is required and where it is not
▪ Optimisations to enhance display performance are impractical. necessary for the object that maintains the state information to know
about the specific display formats used.
30/10/2014 Chapter 7 Design and Implementation 33 30/10/2014 Chapter 7 Design and Implementation 34
The Observer pattern (2)
Multiple displays using the Observer pattern
Pattern name Observer
Solution This involves two abstract objects, Subject and Observer, and two concrete
description objects, ConcreteSubject and ConcreteObject, which inherit the attributes of the
related abstract objects. The abstract objects include general operations that are
applicable in all situations. The state to be displayed is maintained in
ConcreteSubject, which inherits operations from Subject allowing it to add and
remove Observers (each observer corresponds to a display) and to issue a
notification when the state has changed.
The ConcreteObserver maintains a copy of the state of ConcreteSubject and
implements the Update() interface of Observer that allows these copies to be kept
in step. The ConcreteObserver automatically displays the state and reflects
changes whenever the state is updated.
Consequences The subject only knows the abstract Observer and does not know details of the
concrete class. Therefore there is minimal coupling between these objects.
Because of this lack of knowledge, optimizations that enhance display
performance are impractical. Changes to the subject may cause a set of linked
updates to observers to be generated, some of which may not be necessary.
30/10/2014 Chapter 7 Design and Implementation 35 30/10/2014 Chapter 7 Design and Implementation 36
A UML model of the Observer pattern 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 37 30/10/2014 Chapter 7 Design and Implementation 40
Integrated development environments (IDEs) Open source development
Software development tools are often grouped to create Open source development is an approach to software
an integrated development environment (IDE). development in which the source code of a software
An IDE is a set of software tools that supports different system is published and volunteers are invited to
aspects of software development, within some common participate in the development process
framework and user interface. Its roots are in the Free Software Foundation
(www.fsf.org), which advocates that source code should
IDEs are created to support development in a specific
programming language such as Java. The language IDE not be proprietary but rather should always be available
for users to examine and modify as they wish.
may be developed specially, or may be an instantiation
of a general-purpose IDE, with specific language-support Open source software extended this idea by using the
tools. Internet to recruit a much larger population of volunteer
developers. Many of them are also users of the code.
30/10/2014 Chapter 7 Design and Implementation 51 30/10/2014 Chapter 7 Design and Implementation 54
License models
The GNU General Public License (GPL). This is a so-called
‘reciprocal’ license that means that if you use open source
software that is licensed under the GPL license, then you
must make that software open source.
The GNU Lesser General Public License (LGPL) is a variant
of the GPL license where you can write components that link
to open source code without having to publish the source of
these components.
The Berkley Standard Distribution (BSD) License. This is a
non-reciprocal license, which means you are not obliged to re-
publish any changes or modifications made to open source
code. You can include the code in proprietary systems that
are sold.
30/10/2014 Chapter 7 Design and Implementation 59