8/14/2019 schach5-chap08-14[1]
1/43
Slide 8.1
The McGraw-Hill Companies, 2002
Object-Oriented and Classical Software
Engineering
Fifth Edition, WCB/McGraw-Hill, 2002
Stephen R. [email protected]
8/14/2019 schach5-chap08-14[1]
2/43
Slide 8.2
The McGraw-Hill Companies, 2002
CHAPTER 8
REUSABILITY,PORTABILITY, AND
INTEROPERABILITY
8/14/2019 schach5-chap08-14[1]
3/43
Slide 8.3
The McGraw-Hill Companies, 2002
Overview
q Reuse conceptsq Impediments to reuseq Reuse case studiesq Objects and reuseq Reuse during the design and implementation
phasesq Reuse and maintenanceq Portabilityq Techniques for achieving portabilityq Interoperability
8/14/2019 schach5-chap08-14[1]
4/43
Slide 8.4
The McGraw-Hill Companies, 2002
Reuse Concepts
q Two types of reuse Accidental reuse
First, product is built Then, parts put into part database for reuse
Planned reuse First, reusable parts are constructed Then, products are built using these parts
8/14/2019 schach5-chap08-14[1]
5/43
Slide 8.5
The McGraw-Hill Companies, 2002
Why reuse?
q Minor Reason It is expensive to design, implement, test, and
document software Only 15% of new code serves an original purpose
(average)
Reuse of parts saves Design costs Implementation costs Testing costs Documentation costs
q Major Reason Maintenance
q Maintenance consumes two-thirds of software
cost
8/14/2019 schach5-chap08-14[1]
6/43
Slide 8.6
The McGraw-Hill Companies, 2002
Impediments to Reuse
q Not invented here (NIH) syndromeq Concerns about faults in potentially
reusable routinesq Storageretrievalq Cost of reuse
8/14/2019 schach5-chap08-14[1]
7/43
Slide 8.7
The McGraw-Hill Companies, 2002
What sort of reuse rates can we expect?
q Theoretical maximum is 85%q What can we get in practice?q Consider case studies (1975 through 2000)
8/14/2019 schach5-chap08-14[1]
8/43
Slide 8.8
The McGraw-Hill Companies, 2002
Raytheon Missile Systems Division
q Data-processingsoftware
q Planned reuse of Designs
6 code templates COBOL code
3200 reusablemodules
q
Reuse rate 60%(19761982)
8/14/2019 schach5-chap08-14[1]
9/43
Slide 8.9
The McGraw-Hill Companies, 2002
Toshiba Fuchu Works, Tokyo
q Industrial process control systemsq Accidental reuse of
Specifications Designs Modules Contracts Manuals Standards
q
Reuse rate (1985)q 33% designq 48% code
8/14/2019 schach5-chap08-14[1]
10/43
Slide 8.10
The McGraw-Hill Companies, 2002
NASA Software
q Ground support system for unmannedspacecraft control
q Management permitted (but did not encourage)accidental reuse
q Accidental reuse of Modules
q Reuse rate (1982) 28% reused unchanged 10% reused with minor changes
8/14/2019 schach5-chap08-14[1]
11/43
Slide 8.11
The McGraw-Hill Companies, 2002
GTE Data Services
q Data-processing softwareq Strongly encouraged by management
Cash incentives when module was accepted for reuse Cash incentive when module was reused
q Accidental reuse of Modules
q Reuse rate
(1988) 15% reused code, $1.5 million saved (est. 1989) 20% reused code (est. 1993) 50% reused code
8/14/2019 schach5-chap08-14[1]
12/43
Slide 8.12
The McGraw-Hill Companies, 2002
Hewlett-Packard
q Implemented in many divisions of thecompany
q Software Technology Division Accidental reuse of resource planning software 4.1 faults per KLOC of new code, 0.9 for reused
code Overall fault rate decreased 51% Productivity increased 57% Cost $1 million, savings $4.1 million (198392)
8/14/2019 schach5-chap08-14[1]
13/43
8/14/2019 schach5-chap08-14[1]
14/43
Slide 8.14
The McGraw-Hill Companies, 2002
European Space Agency
q Ariane 5 rocket blew up 37 seconds after lift-off q Cost: $500 millionq Reason: attempt to convert 64-but integer into 16-
bit unsigned integer, without Ada exception handler
q On-board computers crashed, so did rocketq Conversion was unnecessary
Computations on the inertial reference system can stop
9 seconds before lift-off But, if there is a subsequent hold in countdown, it takesseveral hours to reset the inertial reference system
Computations therefore continue 50 seconds into flight
8/14/2019 schach5-chap08-14[1]
15/43
Slide 8.15
The McGraw-Hill Companies, 2002
European Space Agency (contd)
q Cause of problem Ten years before, it was mathematically proven that
overflow was impossibleon the Ariane 4 Because of performance constraints, conversions that
could not lead to overflow were left unprotected
Software was used, unchanged and untested, onAriane 5 But, the assumptions for the Ariane 4 no longer held
q Lesson
Software developed in one context needs to beretested when integrated into another context
8/14/2019 schach5-chap08-14[1]
16/43
Slide 8.16
The McGraw-Hill Companies, 2002
Size of Reused Components
q NASA Most reused components were small
q Toshiba Many large components were reused
q
GTE Many large components were reused
q Reason
A strong managerial commitment for reuse is needed
8/14/2019 schach5-chap08-14[1]
17/43
Slide 8.17
The McGraw-Hill Companies, 2002
Objects and Reuse
q Claim of CS/D Ideal module has functional cohesion
q Problem The data on which the module operates
q
We cannot reuse a module unless thedata are identical
8/14/2019 schach5-chap08-14[1]
18/43
8/14/2019 schach5-chap08-14[1]
19/43
8/14/2019 schach5-chap08-14[1]
20/43
Slide 8.20
The McGraw-Hill Companies, 2002
Library or Toolkit
q Set of reusable routinesq Examples:
Scientific software GUI class library or toolkit
q The user is responsible for the control logic (white infigure)
8/14/2019 schach5-chap08-14[1]
21/43
8/14/2019 schach5-chap08-14[1]
22/43
Slide 8.22
The McGraw-Hill Companies, 2002
Design Pattern
q A solution to ageneral designproblem
q In the form of a set
of interactingclassesq The classes need
to be customized(white in figure)
8/14/2019 schach5-chap08-14[1]
23/43
Slide 8.23
The McGraw-Hill Companies, 2002
Widget Generator
q Tool that uses theset of classescreated by thewidget generator
8/14/2019 schach5-chap08-14[1]
24/43
Slide 8.24
The McGraw-Hill Companies, 2002
Abstract Factory Pattern
q Abstract classesand abstract(virtual) methods
q The interfacesbetween client andprogram andgenerator areabstract
q The applicationprogram isuncoupled from thespecific operatingsystem
8/14/2019 schach5-chap08-14[1]
25/43
Slide 8.25
The McGraw-Hill Companies, 2002
Software Architecture
q Encompasses a wide variety of designissues, including: Organization in terms of components How those components interact
8/14/2019 schach5-chap08-14[1]
26/43
Slide 8.26
The McGraw-Hill Companies, 2002
Reuse of Software Architecture
q Architecture reuse can lead to large-scale reuseq One mechanism:
Software product linesq Case study:
Hewlett-Packard printers (1995 to 1998) Person-hours to develop firmware decreased by a factor of 4 Time to develop firmware decreased by factor of 3 Reuse has increased to over 70% of components
8/14/2019 schach5-chap08-14[1]
27/43
Slide 8.27
The McGraw-Hill Companies, 2002
Reuse and Maintenance
q Reuse impacts maintenance more than developmentq Assumptions
30% of entire product reused unchanged 10% reused changed
q Savings during maintenance are nearly 18%q Savings during development are about 9.3%
8/14/2019 schach5-chap08-14[1]
28/43
Slide 8.28
The McGraw-Hill Companies, 2002
Objects and productivity
q Reuse achieved Not via modules with functional cohesion, but via objects (informational cohesion)
[classes]q In general
Software costs have decreased Overall quality has improved Large products are essentially collection of
smaller products
8/14/2019 schach5-chap08-14[1]
29/43
Slide 8.29
The McGraw-Hill Companies, 2002
Difficulties and Problems
q Learning curve Particularly noticeable with GUI
q Problems with inheritance New subclass does not affect its superclass
But, any change to a superclass affects all itssubclasses Subclasses low in the inheritance tree can be huge
(inherited attributes)
q Polymorphism and dynamic binding Maintenance problems were already discussed
8/14/2019 schach5-chap08-14[1]
30/43
Slide 8.30
The McGraw-Hill Companies, 2002
Difficulties and Problems (contd)
q Advantages far outweigh the problems Numerous refereed (e.g., [Capper et al., 1994]) and
informal (OOPSLA Addendum) reports
8/14/2019 schach5-chap08-14[1]
31/43
Slide 8.31
The McGraw-Hill Companies, 2002
Portability
q Product P: Machine M 1 Op. Sys. O 1 Compiler C 1q Need P': Machine M 2 Op. Sys. O 2 Compiler C 2q P is portable if it is cheaper to port P than to write
P' from scratch
8/14/2019 schach5-chap08-14[1]
32/43
Slide 8.32
The McGraw-Hill Companies, 2002
Incompatibilities
q Hardware (disk, tape, characters, parity)q Operating system (JCL, virtual memory)q Numerical software (word size, Ada)q Compiler
FORTRAN Pascal COBOL C Ada C++ Java
8/14/2019 schach5-chap08-14[1]
33/43
Slide 8.33
The McGraw-Hill Companies, 2002
Why Portability?
q Difficulties hamperingportability One-off software Hardware incompatibility Lifetimes of software, hardware Multiple copy software
q Portability saves money!
8/14/2019 schach5-chap08-14[1]
34/43
8/14/2019 schach5-chap08-14[1]
35/43
8/14/2019 schach5-chap08-14[1]
36/43
Slide 8.36
The McGraw-Hill Companies, 2002
Portability Strategies (contd)
q Portable data COBOL, Pascal versus ASCII files DBMS
8/14/2019 schach5-chap08-14[1]
37/43
Slide 8.37
The McGraw-Hill Companies, 2002
Interoperability
q The mutual cooperation of object code From different vendors Written in different languages Running on different machines
q
Example: Nation-wide network of ATMs Server runs database software Clients (ATMs) run C++
Communications software Security
8/14/2019 schach5-chap08-14[1]
38/43
Slide 8.38
The McGraw-Hill Companies, 2002
COM
q Common Microsoft mechanism for allcomponent services Within the same process
Invocation
Different processes on the same machine Interprocess communication
Between different machines Remote process call (RPC)
l d
8/14/2019 schach5-chap08-14[1]
39/43
Slide 8.39
The McGraw-Hill Companies, 2002
How COM Is Implemented
q Each piece is implemented as a COMcomponent (object)
q Each component has one or more interfacesq Each interface supports one or more functions
(methods)q The client calls the COM library and specifies
The class of the component The specific interface
q
The COM library instantiates the COMcomponent
W i
8/14/2019 schach5-chap08-14[1]
40/43
Slide 8.40
The McGraw-Hill Companies, 2002
Warning
q COM uses object-oriented terminology Class Object Method
q
However, COM is currently only object-based, not object-oriented
CORBA
8/14/2019 schach5-chap08-14[1]
41/43
Slide 8.41
The McGraw-Hill Companies, 2002
CORBA
q International standard architecture for object-oriented systems
q Object request broker (ORB) allows client toinvoke a method of any object in the system
q The mother of all client/server middleware
C i COM d CORBA
8/14/2019 schach5-chap08-14[1]
42/43
Slide 8.42
The McGraw-Hill Companies, 2002
Comparing COM and CORBA
q CORBA is an international standard Implemented on a wide variety of platforms
q COM is a Microsoft product Hard to use with non-Microsoft products
q Integration of COTS software is easier with COM Most COTS software is supplied by Microsoft
q CORBA is much simpler than COM
F T d i I bili
8/14/2019 schach5-chap08-14[1]
43/43
Slide 8.43Future Trends in Interoperability
q COM and CORBA are currently the big twoq Other interoperability products may succeed,
such as JavaBeansq Web-based applications need to be integrated
into clientserver productsq XML (Extensible Markup Language) will probably
play a major role