home *** CD-ROM | disk | FTP | other *** search
/ ftp.umcs.maine.edu / 2015-02-07.ftp.umcs.maine.edu.tar / ftp.umcs.maine.edu / pub / WISR / wisr4 / proceedings / detex / sitaraman.detex < prev    next >
Text File  |  1992-04-05  |  18KB  |  514 lines

  1.  [12pt] article 
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.   Inheritance for Software Reuse:  The Good, The Bad, and The Ugly 
  11.  
  12.   Murali Sitaraman and David Eichmann 
  13.          
  14.        Dept. of Statistics and Computer Science 
  15.     West Virginia University 
  16.     Morgantown, WV 26506 
  17.     (murali, eichmann)@cs.wvu.wvnet.edu 
  18.  
  19.    
  20.  
  21.  
  22.   
  23.   Inheritance is a powerful mechanism supported by object-oriented
  24. programming languages to facilitate modifications and extensions of
  25. reusable software components.  This paper presents a taxonomy of the
  26. various purposes for which an inheritance mechanism can be used.
  27. While some uses of inheritance significantly enhance software reuse,
  28. some others are not as useful and in fact, may even be detrimental to
  29. reuse.  The paper discusses several examples, and argues for a
  30. programming language design that is selective in its support for
  31. inheritance.  
  32.  
  33.   0.3in 
  34.  
  35.    Keywords:  extensions, implementation, inheritance, reusable 
  36. software components, specification
  37.  
  38.  
  39.  
  40.   Introduction 
  41.  
  42. Inheritance has been widely recognized as an important mechanism for
  43. constructing new reusable software components from existing components
  44.  .  This paper proposes a taxonomy for
  45. inheritance-based reuse.  Some members of this taxonomy permit
  46. effective reuse and must be supported by object-oriented programming
  47. languages.  However, there are other uses of inheritance that do not
  48. enhance reuse, and may even be detrimental to reuse.  A language must,
  49. therefore, be selective in its support for inheritance.
  50.  
  51.   A Framework for Discussion 
  52.  
  53. We will use the ``3C reference model'' (for reusable software
  54. components) as the basis for our taxonomy in this paper
  55.  .
  56. This model is the result of the discussions at
  57. the Reuse in Practice Workshop (July 1989) and the Workshop on Methods
  58. and Tools for Reuse (June 1990).  The 3C model associates three key
  59. ideas with reusable software components as summarized in  :
  60.   
  61.  [Concept] An abstract (formal) specification explaining
  62. (precisely) what functionality is provided by a software piece,
  63. without saying how the functionality can be realized.
  64.  [Content] (for a concept) A piece of code that (precisely)
  65. describes the data structures and algorithms for implementing (in a
  66. formal, programming language) the concept.
  67.  [Context] A statement (precisely) explaining the environment
  68. (using formal notations) in which a concept or content is presented.
  69.  
  70.  
  71. Several contents may implement the same concept.  They will all be
  72. identical with respect to their functionality, but may be different
  73. with respect to their performance behaviors (e.g., space or time
  74. characteristics) To use a component, a client (user) needs to
  75. understand only its concept. The functional correctness of the client
  76. program depends only on this concept  .  The client will
  77. remain unaffected even if it switches from one content of the concept
  78. to another.  These observations have important implications for
  79. modification and maintenance of software built from reusable
  80. components.  We have used a similar model in our research to
  81. characterize the nature of a components industry that would evolve
  82. when current reuse efforts prove successful  .
  83.  
  84.   A Classification of Uses of Inheritance 
  85.  
  86. Inheritance can be used, in the above framework, to extend (or
  87. modify), and thus, reuse each aspect of a software component -
  88. concept, content, and context.  This section presents a classification
  89. of such uses of inheritance.  We restrict our attention in this paper
  90. to inheritance of concepts and contents alone.  It is important to
  91. note that our classification has nothing to do with the actual
  92. inheritance mechanisms supported in object-oriented languages; it
  93. deals only with the possible uses of inheritance.
  94.  
  95.   A Classification Scheme 
  96.  
  97. The critical issues in inheritance mechanisms from a reuse perspective
  98. are who inherits, what is inherited, and what can be done with that
  99. which is inherited.  We consider each of these issues in turn. This
  100. discussion supports both single and multiple inheritance.
  101.  
  102.   .125in 
  103.  
  104. (i) Who inherits and from whom
  105.  
  106.   .125in 
  107.  
  108. Specification inheritance occurs when parents are concepts.
  109. Implementation inheritance occurs when parents are contents.  These
  110. definitions are similar in spirit to those found in  .  The
  111. heir can be either a concept or a content for either specification or
  112. implementation inheritance. The only combination that is not
  113. meaningful (based on our definitions) is inheritance of a content by a
  114. concept.
  115.  
  116.   .125in 
  117.  
  118. (ii) What parts are inherited
  119.  
  120.   .125in 
  121.  
  122. We focus our attention here only on formally defined concepts and
  123. contents that implement these concepts.  A formal concept for a data
  124. abstraction has two parts: the abstract model(s) that describes the
  125. type(s) provided by the concept, and the abstract specifications of
  126. the operations on the provided type(s).  (When a concept provides only
  127. a procedural abstraction, only the second part is present.)  The
  128. appendix describes an example concept - a formal specification of a
  129. stack data abstraction.
  130.  
  131. A content for a concept defining a data abstraction also has two
  132. parts: the representation(s) of the provided type(s), and the code for
  133. the provided operations.
  134.  
  135. An heir may selectively inherit only parts of a concept or content.
  136.  
  137.   .125in 
  138.  
  139. (iii) The mode of inheritance
  140.  
  141.   .125in 
  142.  
  143. An heir may inherit parts of a concept or a content for read only or
  144. for redefining purposes.  When a heir redefines a part of its parent,
  145. the re-definition may or may not be ``compatible'' with its parent.  The
  146. definition of compatibility depends on what is inherited; usually it
  147. involves restricting the domain of one or more inherited types.
  148.  
  149.   Specification Inheritance - Inheritance of a Concept 
  150.  
  151. A concept can be inherited by either another concept or by a content.
  152. (When multiple concepts are inherited, different concepts could be
  153. affected differently.)
  154.  
  155.   Inheritance by a concept 
  156.  
  157. First, we define what it means for an heir to compatibly redefine its
  158. parent's parts.  The abstract model A of an heir is compatible with
  159. the corresponding model B of its parent, only if the parent concept is
  160. unaffected by substituting A for B.  (For, example, the heir's model
  161. should satisfy the invariants in the parent concept.)  An operation P
  162. in an heir is compatible with the corresponding operation Q in its
  163. parent, only if P's pre-condition is no stronger than Q's and P's
  164. post-condition is no weaker than Q's.
  165.  
  166. Because few object-oriented programming languages have included
  167. rigorous formal specifications, the issues raised by some of these
  168. combinations have not been explored in the community.  In table  , the
  169. meaningful combinations are marked with a  .  For want of space, we
  170. discuss the meaning and relevance of only some of these combinations
  171. here.
  172.   
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.    
  182.    
  183.  
  184.   .125in 
  185.  
  186. (i) Read only - both abstract model(s) and operations
  187.  
  188.   .125in 
  189.  
  190. This is probably the most common mode for specification-based
  191. extensions. For example, a basic stack concept may provide the
  192. operations push, pop, and is-empty. This concept may be extended to
  193. include, say, an operation to reverse a stack. The typical reason for
  194. extending a concept is either that the original concept is not
  195. sufficiently complete or that it is in the developmental stage.  In
  196.  , we have argued for a reason to extend even
  197. well-designed concepts for building efficient implementations. Without
  198. the ability to inherit a concept, this is impossible to do. This use
  199. of inheritance can enhance reuse and programming languages must
  200. support this possibility.
  201.  
  202.   .125in 
  203.  
  204. (ii) Read all and compatibly redefine - operations
  205.  
  206.   .125in 
  207.  
  208. Sometimes, it may be essential to create a new concept by modifying
  209. the specifications of an existing concept.  If the changes are
  210. compatible ( according to the definitions of compatibility in this
  211. section) with the specifications in the original concept, then the new
  212. concept can be used wherever the original concept was being used.  For
  213. example, a stack concept can inherit from a bounded stack concept, and
  214. relax the pre-condition on the push operation. Intuitively, an
  215. unbounded stack can be used wherever a bounded stack can be used.
  216.  
  217.   .125in 
  218.  
  219. (iii) Read all and incompatibly redefine - operations
  220.  
  221.   .125in 
  222.  
  223. If a stack concept is already defined, and someone extends it to be a
  224. bounded stack, this will be the case.  In this case, the model of the
  225. stack has to be extended to include a bound.  In addition, while the
  226. original stack will have no pre-condition for the push operation, the
  227. heir concept will have one.  This is incompatible because the heir has a
  228. stronger pre-condition.  Intuitively, a bounded stack cannot be used
  229. where an unbounded stack was previously used.  If the abstract model
  230. of a type is redefined, the specifications of most, if not all,
  231. operations will have to be redefined.  In this case, inheritance may
  232. result in some, but not in significant reuse.
  233.  
  234.   Inheritance by a content 
  235.  
  236. When a concept is inherited by a content, only few combinations are
  237. meaningful.
  238.   
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.  
  247.    
  248.    
  249.  
  250.   .125in 
  251.  
  252. (i) Read only - both abstract model(s) and operations
  253.  
  254.   .125in 
  255.  
  256. This is the most normal case of concept inheritance by content.  To
  257. implement a concept, a content must inherit it for read only purposes.
  258. Of course, more than one content may inherit the same concept in this
  259. mode, resulting in multiple implementations of a concept.  This is an
  260. important use of inheritance  , and is crucial
  261. for the evolution of a successful components industry.
  262.  
  263.   .125in 
  264.  
  265. (ii) Read all and compatibly redefine - operations
  266.  
  267.   .125in 
  268.  
  269. Sometimes, an implementation of an operation may require fewer
  270. pre-conditions than stated in its specifications and ensure more
  271. post-conditions.  In this case, the operation does more than what the
  272. specification of the operation needs it to do.  For example, an
  273. operation may reclaim unused storage even if it is not explicitly
  274. stated in its specification.
  275.  
  276.   .125in 
  277.  
  278. (iii) Read all and incompatibly redefine - operations
  279.  
  280.   .125in 
  281.  
  282. This is an implementation where the code for some operations do not
  283. provide the behavior specified in the concept.  In otherwords, this
  284. content does not correctly implement its concept, i.e., it is
  285. incorrect.  Clearly, this is a bad use of inheritance.
  286.  
  287.   Implementation Inheritance - Inheritance of a Content 
  288.  
  289. A content can be inherited only by another content.  The concept of
  290. the parent and the heir may or may not be the same.  Just as in the
  291. case of a concept, a content may be inherited in three different
  292. modes.  A content redefines a representation compatibly only if the
  293. heir's representation when used in the place of the parent's
  294. representation leaves the parent content unaffected.  A compatible
  295. redefinition of an operation does not violate the specification of the
  296. operation in the parent content's concept.  Content inheritance may
  297. also be selective.  (When multiple contents are inherited, different
  298. contents could be affected differently.)
  299.   
  300.  
  301.  
  302.  
  303.  
  304.  
  305.  
  306.  
  307.  
  308.    
  309.    
  310.  
  311.   .125in 
  312.  
  313. (i) Read only - both representation(s) and operations
  314.  
  315.   .125in 
  316.  
  317. Apparently, this use of content inheritance is to permit an heir take
  318. advantage of the otherwise hidden details of another content.  For a
  319. well-designed component, providing ``sufficiently complete''
  320. functionality, all essential details of the content may be accessed by
  321. calling the operations in its concept.  This use of inheritance helps
  322. in avoid a few procedure calls, but clearly violates the principle of
  323. information hiding.  This can lead to serious pitfalls, including poor
  324. developmental independence and maintainability
  325.  .
  326. This may, however, be a useful way of keeping track of different
  327. versions of the same content.
  328.  
  329.   .125in 
  330.  
  331. (ii) Read all and compatibly redefine - operations
  332.  
  333.   .125in 
  334.  
  335. This case of content inheritance probably is most useful to keep track
  336. of the different versions of an evolving content.
  337.  
  338.   .125in 
  339.  
  340. (iii) Read all and compatibly redefine - both rep. and operations
  341.  
  342.   .125in 
  343.  
  344. Sometimes, when a new concept is created by compatibly redefining an
  345. existing concept, it may be possible to create a content for the new
  346. concept by compatibly redefining a content of the original concept.
  347. The new content, in this case, will also be a content for the original
  348. concept.
  349.  
  350. Incompatible redefinitions may be useful in some rare cases.  It must
  351. be noted, however, that all uses of content inheritance suffer from
  352. certain basic problems because their violate information hiding.
  353.  
  354.   Discussion 
  355.  
  356. Object-oriented programming languages typically support one mechanism
  357. for inheritance that is useful for various purposes.  While this is
  358. important, we believe the mechanism should be discriminatory and allow
  359. only certain uses.  We have shown that most uses of specification
  360. inheritance are useful and some uses of implementation inheritance may
  361. not be desirable.  The components of a library that would evolve from
  362. discriminatory uses of inheritance will facilitate construction of
  363. software systems that are reliable, modifiable, and maintainable.
  364.  
  365. The work presented here can be formalized, and extended to compare
  366. inheritance mechanisms in various languages and the forms of uses that
  367. are supported.  Also, it is important to identify interesting examples
  368. for the various classes, thereby leading to a better understanding of
  369. the usefulness of these classes.  The present scheme should also be
  370. enhanced to account for context inheritance.
  371.  
  372.    Muralidharan 83a 
  373.  
  374.  
  375. Edwards, S., ``The 3C Model of Reusable Software Components,''
  376.    Third Annual Workshop: Methods and Tools for Reuse,  Syracuse, 1990.
  377.  
  378.  
  379. LaLonde, W. R., ``Designing Families of Data Types Using Exemplars,''
  380.    ACM Transactions on Programming Languages and Systems  11, 2, April 1989, pp. 212-248.
  381.  
  382.  
  383. Latour, L., T. Wheeler, and W. Frakes, ``Descriptive and Predictive Aspects of the 
  384. 3Cs Model: SETA1 working group summary,''
  385.    Third Annual Workshop: Methods and Tools for Reuse,  Syracuse, 1990.
  386.  
  387.  
  388. Liskov, B., ``Data Abstraction and Hierarchy,''    Addendum to the Procs. of OOPSLA 
  389. 1987,  Orlando, FL, pp. 17-34.
  390.  
  391.  
  392. Meyer, B.,    Object-Oriented Software Construction,  Prentice-Hall, Englewood 
  393. Cliffs, NJ, 1988.
  394.  
  395.  
  396. Muralidharan, S., and B. W. Weide, ``Should Data Abstraction Be Violated to 
  397. Enhance Software Reuse?,''    Proc. 8th Annual National Conf. on Ada Technology, 
  398. ANCOST, Inc., Atlanta, GA, Mar.  1990, 515-524.
  399.  
  400.  
  401. Muralidharan, S., and B. W. Weide,  ``Reusable Software Components = 
  402. Formal Specifications + Object Code: Some Implications,''    3rd Annual Workshop: 
  403. Methods and Tools for Reuse,  Syracuse Univ. CASE Center, Syracuse, NY, July 
  404. 1990.
  405.  
  406.  
  407. Parnas, D. L., ``On the Criteria to be Used in Decomposing Systems into Modules,''
  408.    Communications of the ACM  15, 12, December 1972, 1053-1058.
  409.  
  410.  
  411. Raj, R. K., ``Code Inheritance Considered Harmful,''    3rd Annual Workshop: 
  412. Methods and Tools for Reuse,  Syracuse Univ. CASE Center, Syracuse, NY, July 
  413. 1990.
  414.  
  415.  
  416. Sitaraman, M. and D. Eichmann,    Building and Using Efficient Extensions: An 
  417. Approach Based on Inheritance,  TR 91-01-02, Dept. of Stat. and Comp. Science, 
  418. West Virginia University, Morgantown, WV 26506.
  419.  
  420.  
  421. Sitaraman, M.,    Mechanisms and Methods for Performance Tuning of Reusable 
  422. Software Components,  Ph. D. Dissertation, Dept. of Comp. and Info.  Science, Ohio 
  423. State Univ., Columbus, OH, July 1990.
  424.  
  425.  
  426. Tracz, W., ``Where Does Reuse Start?,''    ACM SIGSOFT Software Engineering 
  427. Notes  15, 2, pp. 42-46.
  428.  
  429.  
  430. Tracz, W., ``The Three Cons of Software Reuse,''    Third Annual Workshop: Methods 
  431. and Tools for Reuse,  Syracuse, 1990.
  432.  
  433.  
  434. Weide, B. W., W. Ogden, and S. H. Zweben, ``Reusable Software Components,''
  435.    Advances in Computers,  M. C. Yovits, eds., Academic Press, New York, NY, 1991.
  436.  
  437.  
  438. Weide, B. W.,    Design and Specification of Abstract Data Types Using OWL,  OSU-
  439. CISRC-TR-86-01, Dept. of Comp. and Info. Science, Ohio State Univ., Columbus, 
  440. OH, March 1986.
  441.  
  442.  
  443. Wing, J.  M., ``A Specifier's Introduction to Formal Methods,''    IEEE Computer  23, 
  444. 9, September 1990, pp. 8-24.
  445.  
  446.  
  447.   Appendix: An Example Concept 
  448.  
  449. Figure    shows a concept for a Stack component explained using
  450. a model-based specification.  For our purposes, it does not matter
  451. which specific specification language and/or programming language is
  452. used in explaining concepts and contents. The concepts could use any
  453. of the formal methods described in  .  We have chosen a
  454. dialect of RESOLVE  .
  455.   
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.  
  467.  
  468.  
  469.  
  470.  
  471.    
  472.  
  473.    
  474.  
  475. Here, the type Stack is modeled as a mathematical STRING of Items and
  476. the operations are formally specified using mathematical string
  477. functions EMPTY and POST.  Each operation has been explained using two
  478. clauses: a requires clause that states what must be true of the
  479. arguments passed to the operation and an ensures clause that states
  480. what will be true of the parameters at the completion of the
  481. operation.  In the ensures clause, the notation `` x'' for a parameter x
  482. denotes its incoming value and RxS denotes its value when the
  483. operation returns.  (In the requires clause, the variables always
  484. denote the incoming values.)  The specification of Push, for example,
  485. states that the value of the returned stack (s) is its incoming value
  486. ( s) with the incoming value of x ( x) appended to the end.  The
  487. returned value of x is an initial value of the type Item.
  488.  
  489.   About the Authors 
  490.  
  491. Murali Sitaraman is an Assistant Professor of Computer Science at the
  492. West Virginia University.  He holds a Ph. D. in Computer Science from
  493. The Ohio State University and M. E.  (distinction) from the Indian
  494. Institute of Science.  His current research interests are in data
  495. structures and algorithms, programming languages, software reuse,
  496. verification and validation, and some aspects of distributed
  497. computing.  His Internet address is murali@cs.wvu.wvnet.edu.
  498.  
  499. David Eichmann is currently an Assistant Professor of Computer Science
  500. at West Virginia University and heads the Software Reuse Repository
  501. Lab (SoRReL).  He received his doctorate in computer science from The
  502. University of Iowa, and taught in Seattle University's Master's in
  503. Software Engineering Program before joining WVU.  His research
  504. interests focus on software reuse systems, particularly in the
  505. representation and retrieval of life cycle artifacts, and on database
  506. systems, particularly in type systems for databases.  SoRReL is
  507. currently supported in part by NASA's RBSE project (previously known
  508. as AdaNet).
  509.  
  510.  
  511.  
  512.  
  513.  
  514.