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 / hollingsworth.detex < prev    next >
Text File  |  1992-04-05  |  20KB  |  474 lines

  1.  [12pt] article 
  2.  
  3.  
  4.  
  5.  
  6.  
  7.  
  8.  
  9.  
  10.  
  11.   Confessions of Some Used-Program Clients
  12.   This material based upon work supported by the National 
  13. Science Foundation Grant No. CCR-9111892 
  14.  
  15.  
  16.   Joseph E. Hollingsworth Bruce W. Weide Stuart H. Zweben
  17.   
  18.    Department of Computer and Information Science  
  19.    The Ohio State University  
  20.    2036 Neil Avenue Mall  
  21.    Columbus, OH  43210  
  22.    Tel: 614-292-1517  
  23.    Email: weide@cis.ohio-state.edu  
  24.  
  25.  
  26.    
  27.  
  28.  
  29.  
  30.   
  31. In the past, claims have been made that one can expect 
  32. improved software quality and higher programmer 
  33. productivity by faithful application of abstraction, 
  34. encapsulation and layering (A/E/L).  In an effort to explore 
  35. the effects of A/E/L in the context of reusable software 
  36. components, we conducted an empirical pilot study using a 
  37. class of graduate and upper-division undergraduate 
  38. students.  We present some statistical results concerning the 
  39. effects of A/E/L based on the data collected by the study.
  40.  
  41.   0.3in 
  42.  
  43.    Keywords:  education, guideline development, metrics, reusable software 
  44. components
  45.  
  46.  
  47.  
  48.   The Problem 
  49.  
  50. Many respected software engineers (e.g.,  ) have long argued that 
  51. potentially significant quality and productivity gains can be achieved by faithful 
  52. use 
  53. of abstraction, encapsulation, and layering (A/E/L).  In this approach,
  54. higher-level parts of the system are layered on top of lower-level encapsulated
  55. abstractions.  The claimed benefits stem largely from separation of
  56. concerns between a component's implementer and a component's client.
  57. The component implementer needs to understand only the abstract interface,
  58. not its use by the client; the client can reason 
  59. abstractly about higher layers of software knowing only the abstract interface, not 
  60. its implementation.  If underlying representation or algorithmic details change 
  61. (e.g., to improve performance) the higher layers remain stable.  This modularity 
  62. property 
  63. is especially important when the lower-level abstractions are reusable software 
  64. components  .
  65.  
  66.  
  67. In our experience as ``used-program clients'' (apologies to  ), we have 
  68. noticed that A/E/L principles are not faithfully observed by some used-program 
  69. salesmen.  There are two main problems:
  70.  
  71.   
  72.  
  73.   Some component libraries do not use A/E/L principles as much as they 
  74. could, within those libraries.  For example,   represents a ``map'' 
  75. abstraction as a hash table using chaining for collision resolution.  But he codes 
  76. from scratch the lists that implement chains.  He does not reuse the list package.
  77.  
  78.   The designs of components sometimes interact with each other and with 
  79. certain language features to make it difficult for clients to respect abstraction 
  80. while layering new functionality on top of existing components.  The Booch 
  81. components again provide an example.  Ada's restriction on the mode for 
  82. parameters to functions, mixed use of private and limited private types, and a 
  83. variety of details of the component designs combine to make it surprisingly 
  84. difficult for clients of these components (and all others we know of) to observe 
  85. A/E/L principles  .  It is, therefore, usually considered 
  86. fortunate (although it probably should not be  ) that many 
  87. component libraries are in source form.  This makes it possible for clients to 
  88. extend and change component interfaces to suit their own needs---not by 
  89. layering on top of encapsulated abstractions but by directly modifying them.
  90.  
  91.  
  92. Why should such an apparently well-established principle of software 
  93. engineering---especially one that seems to form the foundation for
  94. software reuse---still be so 
  95. elusive in practice?  We suggest there are two main reasons:
  96.  
  97.   
  98.  
  99.   There are some obvious disadvantages to A/E/L that temper the claimed 
  100. advantages.  The most important is that performance suffers.     Secondary 
  101. operations implemented by layering involve extra procedure call overhead.  This 
  102. is usually a small constant-factor performance penalty that can be reduced with 
  103. aggressive inlining and other compiler optimizations; yet it may be important in 
  104. some applications.  But secondary operations also may be slow because the 
  105.    primary  operations provided by an underlying component do not offer the 
  106. proper abstract functionality, with the right performance, to permit a layered 
  107. implementation to execute as quickly as if it were permitted to access underlying 
  108. representations.  This can be an order-of-magnitude performance penalty that 
  109. the client cannot overcome except by violating abstraction---prying open an 
  110. encapsulated component and delving into the guts of its implementation.
  111.  
  112.   While A/E/L may have many software engineering benefits
  113.    in principle , 
  114. apparently there are no controlled empirical studies that document measurable 
  115. quality or productivity benefits of using these techniques.  In making a trade-off 
  116. between the analyzable and measurable performance penalties associated with 
  117. faithful adherence to A/E/L, and the largely hypothetical and unquantified 
  118. quality and productivity gains, a designer or manager is clearly tempted to opt 
  119. for performance.  This is particularly true where the programming language 
  120. contains ``features'' such as code inheritance that seem to support layering, but 
  121. that actually encourage violation of abstraction and encapsulation 
  122.  .
  123.  
  124.  
  125. We are impressed by the importance of the second point in many informal 
  126. discussions with software practitioners.  Some claim to see the benefits of 
  127. remaining completely faithful to A/E/L.  They blame short-term thinking by 
  128. management, inflexible deadlines, unrealistic performance objectives, and a 
  129. variety 
  130. of other factors, for violations of principles.  The true skeptics, though, 
  131. harbor sincere doubts about the claimed advantages of A/E/L in practice.
  132. They really would 
  133. like to see some empirical evidence that a vigilant adherence to A/E/L 
  134. actually ``works.''
  135.  
  136.  
  137. Having contributed already to the hypothetical academic arguments for 
  138. essentially 
  139. complete allegiance to A/E/L principles in design of reusable software 
  140. components 
  141.  ,
  142. we considered how we might influence potential industrial 
  143. collaborators to undertake a realistic empirical evaluation of the benefits of this 
  144. approach.  During summer 1991 we used a class of 18 graduate and upper-
  145. division 
  146. undergraduate students to conduct an empirical pilot study of some productivity 
  147. and 
  148. quality effects of A/E/L in the context of reusable software components.  The main 
  149. purpose of this paper is to present preliminary results of that study, which
  150. support our position that observing A/E/L principles is an important
  151. factor in obtaining the claimed productivity and quality benefits of reuse.
  152.  
  153.   The Study 
  154.  
  155. The class in question was called ``Software Components Using Ada.''  The 
  156. lectures heavily emphasized the trade-offs evident with A/E/L principles, 
  157. and presented a detailed engineering discipline for designing, 
  158. formally specifying, and correctly and 
  159. efficiently implementing Ada generic packages.  We used   as a 
  160. supplementary text and did one project using the Booch components.  But the 
  161. majority of the course used our own component designs and our own engineering 
  162. discipline  .
  163. Several programming assignments illustrated 
  164. main points from the lectures.  On some of the assignments, we asked the 
  165. students 
  166. to keep track of the effort they spent on various activities (which we defined as 
  167. carefully as possible), and on the number of bugs that caused run-time errors that 
  168. they found and fixed.
  169.  
  170.  
  171. Two of the assignments were particularly relevant to the point of this paper.  In 
  172. the 
  173. first, we provided an implementation of a generic ``unbounded queue'' package 
  174. that 
  175. exported the standard primary operations: enqueue, dequeue, and a test for 
  176. emptiness.  We asked the students to add four secondary operations: copy, clear, 
  177. append (concatenate two queues), and reverse.  We formally specified all the 
  178. operations and discussed them in class so there would be no doubt as to their 
  179. intended semantics.  We asked the students to implement these secondary 
  180. operations using two different methods: (a) by layering them in a new generic 
  181. package on top of the provided queue abstraction, and (b) without layering, i.e., by 
  182. directly modifying the underlying generic package to export the four additional 
  183. operations.  Half the class (nine students chosen at random) did part (a) first; the 
  184. other half did part (b) first.  Below we call these Group A and Group B, 
  185. respectively.
  186.  
  187.  
  188. For the next assignment, we provided a standard solution to part (b) of the above 
  189. assignment, and asked the students to change the underlying representation of 
  190. queues.  This required that they redesign and recode the implementations of the 
  191. original primary operations as well as the four secondary operations.  We asked 
  192. that 
  193. all the students first reimplement the primary operations, then the secondary 
  194. operations.
  195.  
  196.  
  197. For both assignments we asked the students to keep careful records of the time 
  198. they 
  199. spent in designing/coding, testing, and debugging/recoding each operation.  We 
  200. also asked them to report how many bugs they fixed in each operation.  We 
  201. emphasized the importance of being internally consistent in keeping and 
  202. reporting 
  203. this data, and stressed that grades in the course would have nothing to do with 
  204. the 
  205. reported numbers.  After discussing the study with each of the students before 
  206. and 
  207. after the assignments, we found no reason to believe that the results were 
  208. significantly affected by variations in reporting methods, by collaboration, by 
  209. severe outliers, or by latent fears that honest effort/bug data would influence 
  210. course grades.
  211.  
  212.  
  213.   The Results 
  214.  
  215. We have just started to analyze the data and cannot yet report everything that 
  216. might be lurking in them.  We plan to document statistical details of 
  217. the following (and other results) in a future paper.  
  218.    Assignment 1   
  219. Examining average total effort data for the two parts of the 
  220. assignment (Table 1), 
  221. we noted that the students overall spent less than half as much total time 
  222. on the layered implementation as on the one without layering.  Even those 
  223. who did part (a) first spent less total time on the layered implementation 
  224. than on the non-layered one.  Looking at just design/coding effort gave 
  225. a similar picture.
  226.  
  227.   
  228.    Table 1: 
  229.  
  230.    Average Total Times for Assignment 1  
  231.  
  232.      l r r r      
  233.   1    l      & 
  234.   1  c   Group A  & 
  235.   1  c   Group B  & 
  236.   1  c    All   
  237.   1    l      & 
  238.   1  c   (Layered First)  & 
  239.   1  c   (Direct First)  & 
  240.   1  c    Students     
  241.     Layered & 145 & 57  & 101    
  242.     Direct  & 182 & 261 & 222    
  243.     Total   & 327 & 318 & 323    
  244.  
  245.  
  246.  
  247.  
  248. To test the statistical significance of these observations, we performed an analysis 
  249. of variance  , looking for the significance of three primary effects on the 
  250. total effort required for the assignment: (1) the effect due to the treatment, i.e., the 
  251. difference in times to implement the secondary operations with layering and 
  252. without 
  253. layering; (2) the effect due to the group, i.e., the effect, on total time to do the two 
  254. implementations, of the order in which layering and non-layering were done; and 
  255. (3) the interaction effect between treatment and order, i.e., the potential 
  256. ``learning'' 
  257. effect that completing the first implementation had on the time to do the other 
  258. implementation.  Our nested-factorial model also included the effect due to 
  259. students 
  260. within groups and the interaction effect between students and treatments, but 
  261. these 
  262. effects were untestable because we had only one point per student for each level of 
  263. treatment.  In this model, effects (1) and (3) are tested against the interaction 
  264. between students and treatments, while effect (2) is tested against the student 
  265. effect.  
  266. We looked for F values that were significant at the 5  level; with 1 and 16 degrees 
  267. of freedom, the minimum significant F is 4.49.
  268.  
  269.  
  270. We found (Table 2) that effects (1) and (3) were statistically significant, and that 
  271. effect (2) was not significant.  That is, non-layering took significantly more total 
  272. time than layering.  Furthermore, there was an apparent learning effect in the 
  273. sense 
  274. that the total time spent on the first treatment condition was significantly greater 
  275. than 
  276. that for the second treatment condition.  We found no significant difference 
  277. between 
  278. the two groups in the total time to do both parts of the assignment.
  279.  
  280.   
  281.    Table 2: 
  282.  
  283.    Analysis of Variance for Total Time for Assignment 1 
  284.  
  285.      l r r r r     
  286.   1    l     Source/Effect  & 
  287.   1  r     df  & 
  288.   1  c     Sum of Squares  & 
  289.   1  c     Mean Square   & 
  290.   1  c      F      
  291.     Treatment (layering) & 1 & 130,321 & 130,321 & 23.70*     
  292.     Group (order) & 1 & 160 & 160 & 0.02     
  293.     Treatment X Group (learning) & 1 & 63,001 & 63,001 & 11.46*     
  294.     Student (within Group) & 16 & 149,566 & 9,348 &      
  295.     Treatment X Student & 16 & 87,970 & 5,498 &     
  296.  
  297.  
  298.  
  299.  
  300.  
  301.   Significant at the 5  level, i.e.,  . 
  302.  
  303. These data indicate a measurable productivity advantage when secondary 
  304. operations 
  305. are implemented without violating A/E/L principles.  Several students noted in 
  306. their 
  307. lab reports that it was far easier to think abstractly about queues when designing 
  308. and coding the secondary operations than it was to worry about the nodes and 
  309. pointers of the underlying representation.  This seems to be the most reasonable 
  310. explanation of the observed data---exactly what A/E/L advocates might have 
  311. predicted.
  312.  
  313.  
  314. The lack of a significant effect due to order is also plausible from common sense.  
  315. While there is reason to expect that something about the task will be learned from 
  316. the first treatment condition, in fact the mode of thinking, algorithms, and code 
  317. for 
  318. layering and non-layering are quite different.  Therefore, the total time to 
  319. complete 
  320. both parts of the assignment should (intuitively) be independent of which one was 
  321. done first.  Indeed, this is what we observed.
  322.  
  323.  
  324. We also found a significant difference in the quality of the code, as measured by 
  325. the 
  326. number of bugs causing run-time errors that were found and fixed before testing 
  327. revealed no more.  The layered implementations had significantly fewer bugs 
  328. than 
  329. the non-layered ones.  Based on the Mann-Whitney U Test  , we were 
  330. able to reject the hypothesis of no difference between the number of bugs in the 
  331. layered and non-layered implementations, at the 5  level.  
  332.    Assignment 2   
  333. In the second assignment the students undertook a typical maintenance task: 
  334. change 
  335. the representation of an abstraction and all the code that depends on it.  Using 
  336. layering, as in part (a) of the first assignment, means that the code for the 
  337. secondary 
  338. operations can be written once and certified to be correct.  A change to the 
  339. underlying representation costs only as much as changing the primary 
  340. operations.  
  341. The students, however, also had to change the secondary operations, because they 
  342. were implemented without layering.  It was this extra---and with A/E/L 
  343. principles, 
  344. unnecessary---effort that the assignment was intended to help us measure.
  345.  
  346.  
  347. We found that the students averaged spending about half their total redesign and 
  348. recoding effort on the four secondary operations.  However, they had to find and 
  349. fix an average of two-thirds of all their bugs in these operations.  These data have 
  350. such large confidence intervals that we hesitate to draw any serious conclusions 
  351. from a small sample and one example.  Nonetheless, it is entirely plausible that 
  352. secondary operations generally should be more difficult to get right than primary 
  353. operations.  Secondary operations perform more complicated manipulations than 
  354. the primary operations, which are chosen precisely because they are ``primitive.''
  355.  
  356.   Status and Recommendations 
  357.  
  358. We plan to examine more carefully the effort and bug data obtained in this small 
  359. study.  We also hope to refine it and run a study again next year with different 
  360. students.  But the preliminary results suggest that a commercial software 
  361. developer 
  362. might do well to adhere carefully to A/E/L principles on a realistically large 
  363. software 
  364. project, collecting as much similar and related data as possible, in an attempt to 
  365. document a convincing empirical case for the productivity and quality advantages 
  366. of 
  367. A/E/L.  By knowing the cost of design and coding time, maintenance activities, 
  368. etc., and having estimates of the different amounts of time involved in these tasks, 
  369. manager should be able to make a more informed trade-off between software 
  370. engineering costs and run-time performance costs of design decisions.
  371.  
  372.  
  373.  
  374.    [Muralidharan   90b] 
  375.      Booch, G.,    Software Components with Ada ,  
  376. Benjamin/Cummings, Menlo Park, CA, 1987.
  377.  
  378.      Downie, N.M., and Heath, R.W., 
  379.    Basic Statistical Methods, 2nd ed. , Harper   Row, New York, 1965.
  380.  
  381.      Ernst, G.W., Hookway, R.J., Menegay, J.A., and Ogden, 
  382. W.F.,``Modular Verification of Ada Generics,''    Comp. 
  383. Lang. 16 , 3/4 (1991), 259-280.
  384.  
  385.      Harms, D.E., and Weide, B.W.,  ``Copying and Swapping:  
  386. Influences on the Design of Reusable Software 
  387. Components,''    IEEE Trans. on Software Eng. 17 , 5 (May 
  388. 1991), 424-435.
  389.  
  390.      Hicks, C.R., 
  391.    Fundamental Concepts in the Design of Experiments ,
  392. Holt, Rinehart and Winston, New York, 
  393. 1973.
  394.  
  395.      Hollingsworth, J.E., Weide, B.W., and Zweben, S.H., 
  396. ``Abstraction Leaks in Ada,'' 
  397.    Proc. 14th Minnowbrook Workshop on Software Eng. ,
  398. Blue Mountain Lake, NY, July 1991.
  399.  
  400.      LaLonde, W.R., ``Designing Families of Data Types Using 
  401. Exemplars,''     ACM Trans. on Prog. Lang. and Syst. 11 , 2 (1989), 212-248.
  402.  
  403.      Muralidharan, S., 
  404. and Weide, B.W.,  
  405. ``Should Data Abstraction Be Violated to Enhance Software Reuse?,''  
  406.    Proc. 8th Ann. Natl. Conf. on Ada Tech. , ANCOST, Inc., 
  407. Atlanta, GA, Mar. 1990, 515-524.
  408.  
  409.      Muralidharan, S., and Weide, B.W.  ``Reusable Software 
  410. Components = Formal Specifications + Object Code: Some 
  411. Implications,''    3rd Annual Workshop: Methods and Tools 
  412. for Reuse , Syracuse Univ. CASE Center, Syracuse, NY, 
  413. July 1990.
  414.  
  415.      Parnas, D.L., ``On the Criteria to be Used in Decomposing 
  416. Systems into Modules,''    CACM 15 , 12 (Dec. 1972), 1053-1058.
  417.  
  418.      Raj, R.K.,  ``Code Inheritance Considered Harmful,''
  419.    3rd Annual Workshop: Methods and Tools for Reuse , Syracuse 
  420. Univ. CASE Center, Syracuse, NY, July 1990.
  421.  
  422.      Tracz, W.J., ed., 
  423.    Tutorial: Software Reuse: Emerging Technology ,
  424. IEEE Computer Society Press, Washington, DC, 1988, 92-95.
  425.  
  426.      Weide, B.W., Ogden, W.F., and Zweben, S.H.,  
  427. ``Reusable Software Components,'' in    Advances in Computers ,
  428. v. 33, M.C.Yovits, ed., Academic Press, 1991, 1-65.
  429.  
  430.  
  431.  
  432.  * Biographical Data 
  433.  
  434. Joe Hollingsworth holds an undergraduate degree from Indiana University and a 
  435. master's degree from Purdue University.  Before returning to school as a Ph.D. 
  436. candidate at The Ohio State University, he worked at Texas Instruments.
  437. He has 
  438. also consulted for Battelle Memorial Institute on issues of software design
  439. in Ada.  
  440. In his recent research at OSU he has developed a compiler, linker, and 
  441. run-time 
  442. system for RESOLVE, and has worked on a set of engineering principles that can 
  443. be used to develop generic reusable software components in Ada.
  444.   
  445. Bruce W. Weide is Associate Professor of Computer and Information Science at 
  446. The Ohio State University.  He received his B.S.E.E. degree from the University 
  447. of Toledo in 1974 and the Ph.D. in Computer Science from Carnegie Mellon 
  448. University in 1978.  He has been at Ohio State since 1978.  His research interests 
  449. include various aspects of reusable software components and software 
  450. engineering 
  451. in general:  software design-for-reuse, formal specification and verification, data 
  452. structures and algorithms, and programming language issues.  He has also 
  453. published recently in the area of software support for real-time and embedded 
  454. systems.
  455.   
  456. Stuart H. Zweben, a 1974 Ph.D. graduate of Purdue University, is Associate 
  457. Professor of Computer and Information Science at The Ohio State University.  He 
  458. is a leader in the field of software metrics and has published extensively in the 
  459. areas 
  460. of software testing, software engineering methodology, software 
  461. understandability, 
  462. and design of efficient data structures.  His current research interests include 
  463. software reuse and software testing issues, as well as software engineering tools 
  464. and methods, and evaluation techniques for measuring the effects of such tools 
  465. and 
  466. methods.
  467.  
  468.  
  469.  
  470.  
  471.  
  472.  
  473.