Docsity

Software Reuse: Types, Pros, Cons, and Unix Libraries - Prof. Kenneth M. Anderson, Study notes of Software Engineering

Toggle sidebar
bg1
Lecture 10: Software Re-Use
Kenneth M. Anderson
Software Methods and Tools
CSCI 3308 - Fall Semester, 2004
September 24, 2004 © University of Colorado, 2004 2
Today’s Lecture
Software Reuse
Types of Reuse
Pros and Cons
Introduction to Unix Libraries
Brooks’ Corner: Second System Effect
But first

Conceptual Integrity and System Architects at Bell
Labs
Architects are not associated with development groups;
they must “pitch” their designs to groups and get them
“adopted”
September 24, 2004 © University of Colorado, 2004 3
Software Reuse
Software Reuse involves
the use of some previously constructed
software artifact
source code, library, component
requirements and design documents
e.g. design patterns
in a new context or development project
September 24, 2004 © University of Colorado, 2004 4
Types of Software Reuse
In re-using code, we have several levels of
granularity
single lines of code
functions/procedures
modules
components
packages
subsystems
entire programs
pf3
pf4
pf5

Partial preview of the text

Download Software Reuse: Types, Pros, Cons, and Unix Libraries - Prof. Kenneth M. Anderson and more Study notes Software Engineering in PDF only on Docsity!

Lecture 10: Software Re-Use

Kenneth M. AndersonSoftware Methods and ToolsCSCI 3308 - Fall Semester, 2004

September 24, 2004

© University of Colorado, 2004

Today’s Lecture^ ^ Software Reuse^ ^ Types of Reuse^ ^ Pros and Cons^ ^ Introduction to Unix Libraries^ ^ Brooks’ Corner: Second System Effect^ ^ But first
^ ^ Conceptual Integrity and System Architects at BellLabs^ ^ Architects are not associated with development groups;they must “pitch” their designs to groups and get them“adopted”

September 24, 2004

© University of Colorado, 2004

3

Software Reuse^ ^ Software Reuse involves^ ^ the use of some previously constructedsoftware artifact^ ^ source code, library, component^ ^ requirements and design documents

^ e.g. design patterns  in a new context or development project

September 24, 2004

© University of Colorado, 2004

Types of Software Reuse^ ^ In re-using code, we have several levels ofgranularity^ ^ single lines of code^ ^ functions/procedures^ ^ modules^ ^ components^ ^ packages^ ^ subsystems^ ^ entire programs

© University of Colorado, 2004

5

Other Types of Software Reuse^ ^ Reuse can also include^ ^ Requirements Documents^ ^ Design Documents^ ^ Design Patterns^ ^ Software Architectures^ ^ a set of connected components at a high level ofabstraction^ ^ This type of reuse can be morepowerful
why?

September 24, 2004

© University of Colorado, 2004

No Silver Bullet, revisited^ ^ Producing requirements and design information is hard^ ^ We struggle with the essential difficulties of software whenwe create these documents^ ^ Coding is relatively easy, in comparison^ ^ Typical projects spend 25% of their time coding, 75% onrequirements, design, and debugging^ ^ In fact, Brooks estimates that most projects spend at least 50%of their time debugging!^ ^ Reuse can help to address these problems^ ^ Reused reqs./design/code require less debugging

© University of Colorado, 2004

7

Pros of Software Reuse^ ^ Efficiency^ ^ Reduces time spent designing or coding^ ^ Standardization^ ^ Reuse of UI widgets in MacOS and Win32 leads to common“look-and-feel” between applications^ ^ Debugging^ ^ Reused design/code is often tested design/code^ ^ Profit!^ ^ Reuse can lead to a market for component software^ ^ real-world examples: ActiveX components, Hypercard stacks,Java packages, even software tools, such as xerces and xalanfrom xml.apache.org (they are often included in other softwaresystems)

September 24, 2004

© University of Colorado, 2004

Cons of Software Reuse^ ^ Mismatch^ ^ Reused Reqs. and/or Design may not completely match yoursituation^ ^ Requires time/effort to convert^ ^ Non-functional characteristics of code may not match yoursituation^ ^ Consider a database that can scale to 10,000s of items, butyou need it to scale to 100,000s of items^ ^ Expense^ ^ Some components may be too expensive for your project’sbudget. For instance, SGML (a precursor to HTML and XML)tools sell for 5000 dollars a license!

© University of Colorado, 2004

13

Marshalling example^ ^ When a program calls a function, itsparameters are pushed onto theprogram stack^ function

foo(int

x, float y, char z) { 
 } foo(5, 7.2,

‘c’)

September 24, 2004

© University of Colorado, 2004

Marshalling example,continued

SP

z: 1 bytey: 4 bytesx: 2 bytes

‘c’ 7.2^5 When linking the object code, the linker substitutes(SP-1) for z, (SP-5) for y, and (SP-7) for x. Thisworks as long as both the calling program and thecalled function follow the same rules. This is whatmarshalling specifies and it allows libraries to bereused on Unix systems.

© University of Colorado, 2004

15

Marshalling, continued^ ^ In order to use a library, a developer needs^ ^ a header file (.h) that indicates the parameters of eachfunction contained in the library^ ^ the object code of the library^ ^ A compiler can then link the object code of the libraryinto a developer’s program using the rules ofmarshalling
^ ^ 
and a developer’s program can then use thefunctions contained in that library

September 24, 2004

© University of Colorado, 2004

Next Lecture^ ^ We will learn how to create libraries with thear (“archive”) command^ ^ We will learn about command flags of the Cand C++ compilers that allow libraries to bere-used in new programs

© University of Colorado, 2004

17

Brooks’ Corner: The Second-System Effect^ ^ An engineer is careful in designing a systemthe first time^ ^ He or she realizes that they are working inuncharted territory^ ^ Extraneous features get delayed until
^ ^ The Second System!^ ^ Now, you’ve got some experience and you want tothrow everything into the design!

September 24, 2004

© University of Colorado, 2004

Symptoms of Second-System Effect^ ^ Functional Embellishment^ ^ to an unnecessary degree^ ^ Optimizations to obsolete functionality^ ^ OS/360 linker had sophisticated program overlayfunctionality^ ^ The problem: the application architecture no longerdepended on overlays!^ ^ Side-effect: linker is slower than it otherwise would have been;slower than the compilers whose usage it was meant to reduce!

© University of Colorado, 2004

19

How to avoid it?^ ^ Must employ extra self-discipline^ ^ avoid functional ornamentation^ ^ be aware of changes in assumptions^ ^ strive for conceptual integrity^ ^ How do manager’s avoid it?^ ^ Insist on a senior architect with more than twosystems under his or her belt^ ^ If this is not possible, then help your architect avoid thesecond system effect: e.g. question unnecessaryfeatures, review assumptions, etc.