100 likes | 121 Views
CSE350 Software Design and Engineering. University of Pennsylvania http://www.cis.upenn.edu/~jms Office: 254 Moore GRW, Phone: 8-9509 February 12 th , 2002. Software Reuse. What is software reuse? Can software be “reused”? What effect does it have on lifecycle?
E N D
CSE350 Software Design and Engineering University of Pennsylvania http://www.cis.upenn.edu/~jms Office: 254 Moore GRW, Phone: 8-9509 February 12th, 2002
Software Reuse • What is software reuse? • Can software be “reused”? • What effect does it have on lifecycle? • Are there examples of its success? • Libraries • UNIX filters + pipes • What can we learn from these examples?
What is software reuse? • Once software is written & debugged, it is a “building block” that can be used in future systems • Attractive idea: write-once, reuse many • Not necessarily systems, usually components are reused • Composability is a requirement
Can software be reused? • If it can be composed with other existing software it can be reused • If building block for other software, it can be reused (and it eases the writing of the other software) • Not always possible: new contexts • Informal habit of experienced programmers: save all your code!
Lifecycle issues • Less code - less design and testing • Shared maintenance costs (remember, these are large) • Sunk investment • Costs amortized over more uses of software • Shortens learning curve - familiarity
Successes: Libraries • A library, e.g. the util.c file in examples, contains routines that prove useful in many programs. They are tested and robust. E.g., emalloc(), strsave(), etc. • Libraries normally raise the level of abstraction for programmers • cc -l{libname}, e.g., cc -lm for math stuff
Successes: OSes • Operating Systems began as I/O control systems (IOCCs). • They provide shared services that change the level of abstraction - read()/write() rather than device manipulation • Good software, written once, used by most programs
Successes: Pipe + Filter • Composable executables • Glued together with cmd interpreter (shell) • Read from stdin, write to stdout • Interoperability layer is bytestream • Raises level of abstraction
Polymorphism • #define PRODUCT(_a,_b) (_a)*(_b) • Reusable because abstract • Object type defines behavior • Supported in some modern programming languages such as ML.
Lessons from examples? • Work is saved by working at higher level of abstraction (C vs. shell) • Reusable routines are general, to encourage many uses. • Need to have support for composition - note that successful examples used elements such as procedures and executable modules