KEMBAR78
Ch7 Design and Implementation | PDF | Source Code | Computer Programming
0% found this document useful (0 votes)
113 views35 pages

Ch7 Design and Implementation

The document describes a case study of a wilderness weather station system. It discusses the key components of the weather station including instruments to measure temperature, pressure, rainfall, wind speed and direction. It also describes the weather information system that collects and analyzes data from the weather stations. The document covers the system context, use cases including reporting weather data, high-level architecture using a client-server model for data collection, object classes to represent instruments and weather data, and the Observer design pattern to support multiple displays of weather data.

Uploaded by

Nilno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views35 pages

Ch7 Design and Implementation

The document describes a case study of a wilderness weather station system. It discusses the key components of the weather station including instruments to measure temperature, pressure, rainfall, wind speed and direction. It also describes the weather information system that collects and analyzes data from the weather stations. The document covers the system context, use cases including reporting weather data, high-level architecture using a client-server model for data collection, object classes to represent instruments and weather data, and the Observer design pattern to support multiple displays of weather data.

Uploaded by

Nilno
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

Chapter 7 Design and Implementation

Letizia Jaccheri

Professor Institutt for Datateknikk (IDI)


Office 106, tel. (735)93469, letizia@idi.ntnu.no
www.letiziajaccheri.org
Course home page http://www.idi.ntnu.no/emner/tdt4140/

Slides made by Sommerville adapted by Letizia


Jaccheri, all the slides are part of the syllabus
This lecture will be filmed English!!

Topics covered
Case Study (Weather station)
Design patterns (Observer)
Implementation issues
Open source
off-the-shelf systems
development

Software
specification
Software
development
Software validation
Software evolution

Chapter 7 Design and implementation

A wilderness weather station


A data collection system that collects data about
weather conditions in remote areas.

Chapter 7 Design and implementation

Wilderness weather station


The government of a country with large areas of
wilderness decides to deploy several hundred weather
stations in remote areas.
Weather stations collect data from a set of instruments
that measure temperature and pressure, sunshine,
rainfall, wind speed and wind direction.
The weather station includes a number of instruments that
measure weather parameters such as the wind speed and
direction, the ground and air temperatures, the barometric
pressure and the rainfall over a 24-hour period. Each of these
instruments is controlled by a software system that takes
parameter readings periodically and manages the data collected
from the instruments.

Chapter 1 Introduction

Weather information system


The weather station system
This is responsible for collecting weather data, carrying out some
initial data processing and transmitting it to the data management
system.

The data management and archiving system


This system collects the data from all of the wilderness weather
stations, carries out data processing and analysis and archives the
data.

The station maintenance system


This system can communicate by satellite with all wilderness
weather stations to monitor the health of these systems and provide
reports of problems.
Chapter 1 Introduction

Additional software functionality


Monitor the instruments, power and communication
hardware and report faults to the management system.
Manage the system power, ensuring that batteries are
charged whenever the environmental conditions permit
but also that generators are shut down in potentially
damaging weather conditions, such as high wind.
Support dynamic reconfiguration where parts of the
software are replaced with new versions and where
backup instruments are switched into the system in the
event of system failure.

Chapter 1 Introduction

Weather station description

A weather station is a package of software controlled instruments


which collects data, performs some data processing and transmits
this data for further processing. The instruments include air and
ground thermometers, an anemometer, a wind vane, a barometer
and a rain gauge. Data is collected periodically.
When a command is issued to transmit the weather data, the
weather station processes and summarises the collected data.
The summarised data is transmitted to the mapping computer
when a request is received.

Chapter 7 Design and implementation

System context
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.

Chapter 7 Design and implementation

System context for the weather station

Chapter 7 Design and implementation

Interaction model
An interaction model is a dynamic model that shows how
the system interacts with its environment as it is used.

Chapter 7 Design and implementation

10

Weather station use cases

Chapter 7 Design and implementation

11

Use case descriptionReport 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.

Chapter 7 Design and implementation

12

High-level architecture of the weather station

Client server

Chapter 7 Design and implementation

13

Architecture of data collection system

Pipe & Filter

Chapter 7 Design and implementation

14

Approaches to identification
1. Use a grammatical approach based on a natural
language description of the system (used in Hood OOD
method).
2. Base the identification on tangible things in the
application domain.
3. Use a behavioural approach and identify objects based
on what participates in what behaviour.
4. Use a scenario-based analysis. The objects, attributes
and methods in each scenario are identified.

Chapter 7 Design and implementation

15

Weather station object classes


Object class identification 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.

Chapter 7 Design and implementation

16

Weather station object classes

Chapter 7 Design and implementation

17

Sequence diagram describing data collection

Chapter 7 Design and implementation

18

Weather station state diagram


You do not need state diagrams for
All objects

Chapter 7 Design and implementation

19

Weather station interfaces

The UML uses class diagrams for interface specification but Java may also be used.

Chapter 7 Design and implementation

20

Pattern elements
Name
A meaningful pattern identifier.

Problem description.
Solution description.
Not a concrete design but a template for a design solution that
can be instantiated in different ways.

Consequences
The results and trade-offs of applying the pattern.

Chapter 7 Design and implementation

21

The Observer pattern


Name
Observer.

Description
Separates the display of object state from the object itself.

Problem description
Used when multiple displays of state are needed.

Solution description
See slide with UML description.

Consequences
Optimisations to enhance display performance are impractical.

Chapter 7 Design and implementation

22

The Observer pattern (1)

Pattern
name

Observer

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
changes, all displays are automatically notified and updated to reflect the
change.

Problem
description

In many situations, you have to provide multiple displays of state


information, such as a graphical display and a tabular display. Not all of
these may be known when the information is specified. All alternative
presentations should support interaction and, when the state is changed,
all displays must be updated.
This pattern may be used in all situations where more than one
display format for state information is required and where it is not
necessary for the object that maintains the state information to know
about the specific display formats used.

Chapter 7 Design and implementation

23

The Observer pattern (2)

Pattern name

Observer

Solution
description

This involves two abstract objects, Subject and Observer, and two concrete
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.
Chapter 7 Design and implementation

24

Multiple displays using the Observer pattern

Chapter 7 Design and implementation

25

A UML model of the Observer pattern

Consists of

Is a

1:N

Is a

Chapter 7 Design and implementation

26

Implementation issues
Software engineering is more than programming
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.
Testing!!!

Chapter 7 Design and implementation

27

Development platform tools


lists of tools suggested by Hallvard Trtteberg
http://www.junit.org/ Junit - unity testing
http://cobertura.sourceforge.net Cobertura test
coverage
http://findbugs.sourceforge.net FindBugs static analysis
https://github.com Git Version Control
http://ant.apache.org/ Ant building
http://maven.apache.org/ Maven dependency and
building
http://www.eclipse.org/ Eclipse
Chapter 7 Design and implementation

28

Open source development


Open source development is an approach to software
development in which the source code of a software
system is published
and volunteers are invited to participate in the development
process (not always http://scratch.mit.edu/)

Its roots are in the Free Software Foundation


(www.fsf.org), which advocates that source code should
not be proprietary but rather should always be available
for users to examine and modify as they wish.
Open source software extended this idea by using the
Internet to recruit a much larger population of volunteer
developers. Many of them are also users of the code.
Chapter 7 Design and implementation

29

Open source systems


The best-known open source product is, of course, the
Linux operating system which is widely used as a server
system and, increasingly, as a desktop environment.
Other important open source products are Java, the
Apache web server and the mySQL database
management system.

Chapter 7 Design and implementation

30

Open source issues


Should the product that is being developed make use of
open source components?
Should an open source approach be used for the
softwares development?

Chapter 7 Design and implementation

31

Open source business

More and more product It was a trend 10 years


companies are using an
ago, we do not have
open source approach
scientific data about
to development
this trend
Their business model is
More true for WEB
not reliant on selling a
Facebook is based on
the LAMP stack
software product but
Google gives out source
on selling support for
code
that product.
Than traditional such as
They believe that
banking, oil, public (see
involving the openChapter 7 Design and implementation
32
ALTINN)
source community will

Open source licensing


A fundamental principle of open-source development is
that source code should be freely available, this does not
mean that anyone can do as they wish with that code.
Legally, the developer of the code (either a company or an
individual) still owns the code. They can place restrictions on
how it is used by including legally binding conditions in an open
source software license.
Some open source developers believe that if an open source
component is used to develop a new system, then that system
should also be open source.
Others are willing to allow their code to be used without this
restriction. The developed systems may be proprietary and sold
as closed source systems.
Chapter 7 Design and implementation

33

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 republish any changes or modifications made to open source
code. You can include the code in proprietary systems that
are sold (same in Apache)
Chapter 7 Design and implementation

34

License management
Establish a system for maintaining information about
open-source components that are downloaded and
used.
Be aware of the different types of licenses and
understand how a component is licensed before it is
used.
Be aware of evolution pathways for components.
Educate people about open source.
Have auditing systems in place.
Participate in the open source community.
Chapter 7 Design and implementation

35

You might also like