Software Reuse: ©ian Sommerville 2004 Slide 1
Software Reuse: ©ian Sommerville 2004 Slide 1
Increased dependability Reused software, that has been tried and tested in working systems,
should be m ore dependable than new software. The initial use of the
software reveals any design and implementation faults. These are then
fixed, thus reducing the number of failures when the software is reused.
Reduced process risk If software exists, there is less uncertainty in the costs of reusing that
software than in the costs of development. This is an important factor
for project management as it reduces the margin of error in project cost
estimation. This is particularly true when relatively large software
components such as sub-systems are reused.
Effective use of specialists Instead of application specialists doing the same work on different
projects, these specialists can develop reusable software that
encapsulate their knowledge.
Creating and maintaining a Populating a reusable component library and ensuring the software
component library developers can use this library can be expensive. Our current techniques
for classifying, cataloguing and retrieving software components are
immature.
Finding, understanding and Software components have to be discovered in a library, understood and,
adapting reusable components sometimes, adapted to work in a n ew environment. Engineers must be
reasonably confident of finding a component in the library before they will
make routinely include a component search as part of their normal
development process.
CompC
O
LegaT
develo S
Pr
ra
inte
rat
wrap
Con g
tic
app
Servi
syste
Prog
ram
libra
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 11
Reuse approaches 1
Sub
Obse
A:
B:
5
C:
D:
0Ob4
2
1
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 18
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.
Detach
for
o al
Notify
Con
Concre->
ob
return
Upd
GetSta
subjec
obs s
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 20
Generator-based reuse
● Program generators involve the reuse of
standard patterns and algorithms.
● These are embedded in the generator and
parameterised by user commands. A program
is then automatically generated.
● Generator-based reuse is possible when
domain abstractions and their mapping to
executable code can be identified.
● A domain specific language is used to
compose and control these abstractions.
Ap
tion
pli
kno
wleD
tba
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 23
Aspect-oriented development
● Aspect-oriented development addresses a major
software engineering problem - the separation of
concerns.
● Concerns are often not simply associated with
application functionality but are cross-cutting - e.g. all
components may monitor their own operation, all
components may have to maintain security, etc.
● Cross-cutting concerns are implemented as aspects
and are dynamically woven into a program. The
concern code is reuse and the new system is
generated by the aspect weaver.
Input
e
join Ge
Asp
<
<state
W av
<
<stateAs
p
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 25
Application frameworks
● Frameworks are a sub-system design made
up of a collection of abstract and concrete
classes and the interfaces between them.
● The sub-system is implemented by adding
components to fill in parts of the design and by
instantiating the abstract classes in the
framework.
● Frameworks are moderately large entities that
can be reused.
Mode
Mod
ModM
a n
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 30
Application system reuse
● Involves the reuse of entire application
systems either by configuring a system
for an environment or by integrating
two or more systems to create a new
application.
● Two approaches covered here:
• COTS product integration;
• Product line development.
E-com
Or
Ada
syste
inv
E-mAd
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 34
COTS products reused
● On the client, standard e-mail and web
browsing programs are used.
● On the server, an e-commerce platform has to
be integrated with an existing ordering system.
• This involves writing an adaptor so that they can
exchange data.
• An e-mail system is also integrated to generate e-
mail for clients. This also requires an adaptor to
receive data from the ordering and invoicing
system.
Conf
data
S
yst
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 40
ERP systems
● An Enterprise Resource Planning (ERP)
system is a generic system that supports
common business processes such as ordering
and invoicing, manufacturing, etc.
● These are very widely used in large
companies - they represent probably the most
common form of software reuse.
● The generic core is adapted by including
modules and by incorporating knowledge of
business processes and rules.
deli
authma
Reso
T Re
Res
manaall
con
rRes
ans
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 44
Vehicle despatching
● A specialised resource management system where the aim
is to allocate resources (vehicles) to handle incidents.
● Adaptations include:
• At the UI level, there are components for operator display
and communications;
• At the I/O management level, there are components that
handle authentication, reporting and route planning;
• At the resource management level, there are components for
vehicle location and despatch, managing vehicle status and
incident logging;
• The database includes equipment, vehicle and map
databases.
V
e V
eEqu
Incid
hicle
mana
T
r V
e
hic
ma
logg
deslo
Inc
ans
Equip h
datab
V
ehic
Ma
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 46
Ren
Product instance development
req
Elicit
Choo
stakeh
close
require
famil
Ada
D
sys
fa
©Ian Sommerville 2004 Software Engineering, 7th edition. Chapter 18 Slide 47
Product instance development
● Elicit stakeholder requirements
• Use existing family member as a prototype
● Choose closest-fit family member
• Find the family member that best meets the requirements
● Re-negotiate requirements
• Adapt requirements as necessary to capabilities of the software
● Adapt existing system
• Develop new modules and make changes for family member
● Deliver new family member
• Document key features for further member development