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 / wisr6 / proceedings / ascii / thomas.ascii < prev    next >
Text File  |  1993-10-19  |  18KB  |  380 lines

  1.  
  2.  
  3.  
  4.  
  5.                 A  Scalable  Approach  to  Software  Libraries
  6.  
  7.  
  8.  
  9.                Jeff Thomas, Don Batory, Vivek Singhal, and Marty Sirkin
  10.  
  11.  
  12.  
  13.                                 Department of Computer Sciences
  14.  
  15.                                 The University of Texas at Austin
  16.  
  17.                                           Austin, Texas 78712
  18.  
  19.                                        Tel:  (512) 471-9711/9713
  20.  
  21.                    Email: fjthomas,batory,singhal,martyg@cs.utexas.edu
  22.  
  23.  
  24.  
  25.                                                   Abstract
  26.  
  27.  
  28.     Software libraries offer a convenient and accessible means to achieve the benefits of reuse. The
  29. components of these libraries are written by hand, and each represents a unique combination of
  30. features that distinguishes it from other components. Unfortunately, as the number of features
  31. grows, the size of these libraries grows exponentially, making themunscalable.
  32.     Predator is a research project to develop abstractions and tools to provide the benefits of
  33. software libraries without incurring the scalability disadvantages just mentioned. Our approach
  34. relies on a careful analysis of an application domain to arrive at appropriate high-level abstrac-
  35. tions,  standardized  (i.e.,  plug-compatible)  interfaces,  and  layered  decompositions.  Predator
  36. provides  language  extensions  for  implementing  components, and  compilers  to  automatically
  37. convert component compositions into efficient programs.
  38.  
  39.  
  40. Keywords: Predator, GenVoca, domain analysis, containers, software libraries, software reuse,
  41. compositional reuse, generative reuse, feature combinatorics.
  42.  
  43.  
  44. Workshop Goals: feedback on our work; exposure to other important work in software reuse.
  45.  
  46.  
  47. Working  Groups:  reuse  process  models;  reuse terminology  standards;  domain  analysis  /
  48. engineering; design guidelines for reuse-general, Ada, and C++; reuse and OO methods; tools
  49. and environments.
  50.  
  51.  
  52.  
  53.                                                  Thomas- 1
  54.  
  55.  
  56. 1      Introduction
  57.  
  58.  
  59.  
  60. Domain-specific software libraries are becoming an increasingly common means of rapidly building
  61. software  systems.  Such  libraries  offer  numerous  software  components  that implement  different
  62. algorithms  from  a  given  problem  domain.  For  example, consider  the  domain  of  data  structure
  63. algorithms  (i.e., containers  of  objects).   Examples  include  linked  lists,  arrays,  trees, and  hash
  64. tables.  Because eachof these structures could be implemented using a variety of algorithms, the
  65. domain of data structures is clearly quite large. The FSF's libg++ class library [1] and the C++
  66. Booch Components [2] are examples of data structure software libraries.
  67.  
  68.  
  69. Although software libraries offer a simple and effective means of attaining the benefits of reuse,
  70. they also expose a basic obstacle that limits the long-term success of software libraries as a reuse
  71. paradigm. The Booch Components offers numerous implementations for each basic data structure;
  72. for example, it provides 3  3  2 = 18 varieties of deques (double-ended queues)! A developer can
  73. choose a deque's algorithm for concurrency control (sequential, guarded, synchronized), memory
  74. allocation (bounded, unbounded, dynamic), and priority (ordered, unordered). Each of these fea-
  75. ture selections is mutually independent; consequently,  the implementor of the component library
  76. must laboriously enumerate every permutation of feature selections.
  77.  
  78.  
  79. As the number of available features increases, the size of component libraries grows exponentially.
  80. For  example, suppose  a  new  feature  were  added  which  let  a  library  user  choose  if  the  elements
  81. of  a  deque  should  be  stored  in  persistent  memory  or  transient memory;  the  number  of  deque
  82. components would then double from eighteen to thirty-six.  It is apparent that as domain-specific
  83. software libraries achieve broader use, they will need to support an even broader range of features,
  84. thus aggravating this problem of feature combinatorics.
  85.  
  86.  
  87. Feature combinatorics is a serious problem.  Consider the following disadvantages for the library
  88. implementor:
  89.  
  90.  
  91.  
  92.     fflLibrary growth can be explosive.
  93.  
  94.  
  95.     fflLibrary maintenance is complicated by the large number of components.
  96.  
  97.  
  98.     fflCode repetition is a nightmare that inheritance alone cannot solve.
  99.  
  100.  
  101.  
  102. And the following disadvantages for the library user:
  103.  
  104.  
  105.  
  106.     fflIf the library implementor is unable/unwilling to supply components that enumerate every
  107.        permutation of features, then it is likely that some application will eventually need a particular
  108.        combination of features which isn't implemented by any component.
  109.  
  110.  
  111.     fflSearching for the appropriate component is difficult when the size of the library is large.
  112.  
  113.  
  114.  
  115. This  problem  of  feature  combinatorics  is  not  unique  to  data  structures.  Twenty-five  years  ago,
  116. McIlroy  [3]  postulated  that  a  well-stocked  library  of  sine  routines  would  likely contain  as  many
  117. as 300 components, supporting different degrees of precision, granularity, range, and robustness.
  118. Krueger  recognized  that  the  problem  of  feature  combinatorics  is,  unfortunately,  inherent  to  all
  119. libraries [4].  Clearly, we must find a means of populating libraries of software components which is
  120. scalable with respect to the number of features offered by the library.
  121.  
  122.  
  123.  
  124.                                                         Thomas- 2
  125.  
  126.  
  127. 2      Predator
  128.  
  129.  
  130.  
  131. The Predator system is based on the idea that data structures should be mechanically generated
  132. from libraries of primitive components, where each component implements precisely one feature.
  133. Users specify the set of features that they want,and Predator synthesizes the target data structure.
  134. This approach eliminates the implementation and maintenance problems of feature combinatorics,
  135. and is scalable by just adding new primitives to the Predator library.
  136.  
  137.  
  138. In program generation systems like Predator, careful designand implementation of components is
  139. critical.  The interfaces of components shouldreflect the basic abstractions of the domain.  Such
  140. interfaces might be identified using domain modeling techniques.  In Predator,component interfaces
  141. actually  were  deliberately  designed  to  ensure  that  they  would  be  suitable  for  building  complex
  142. data structures.  Good component designs result from interfaces that p ossess the following three
  143. properties [5, 6 ]:
  144.  
  145.  
  146.  
  147.     1. High-level  abstractions.  It  is  well-known  that  using  high-level  abstractions  makes  pro-
  148.        grams easier to write and debug. It is essential for component interfaces to hide the complex
  149.        details of their encapsulated data structures; not doing so would make components difficult
  150.        to use and virtually impossible to combine.
  151.  
  152.  
  153.     2. Standardized  interfaces.  A  key feature of software component/software generator tech-
  154.        nologies is the ability to interchange different data structure implementations to address ap-
  155.        plication performance requirements. Note that plug-compatible interfaces are already present
  156.        to some extent in existing component libraries (such as Booch Components and libg++). In
  157.        fact,  all  basic  data  structures  (lists,  trees,  arrays,  etc.)  could  even  be  viewed  as  different
  158.        implementations of the same container abstraction (that is, all of these data structuresserve
  159.        as containers for collections of objects).
  160.  
  161.  
  162.     3. Layered  designs.  Experience  has  shown  that  many  software  systems  have  hierarchical
  163.        designs.  The layering of abstractions (and their implementations)provides a powerful way
  164.        to design, build, and understand complex software.  Layering is an important technique for
  165.        managing  complexity.  By  partitioning  a  system  into  layers, system  design  can  be  greatly
  166.        simplified.
  167.  
  168.  
  169.  
  170. High-level  abstractions, standardized  interfaces, and  layered  designs  characterize  our  implemen-
  171. tation of Predator.  Each data structure feature is encapsulated in a separate component.  This
  172. collection of components_which is inherently open-ended_defines the Predator library.  Target
  173. data  structures_those  that  would  be  requested  by  Predator  users_are  specified  as  hierarchical
  174. compositions of library components.
  175.  
  176.  
  177. Predator provides language extensions to support the specification and composition of primitive
  178. components, and compilers to convert them into efficient executable code.  The Predator compil-
  179. ers use advanced optimizations such asinlining and partial evaluation.  Currently, there are two
  180. compilers (P1 [7 ] and P2 [8 ]), both providing language extensions to ANSI C.1
  181.  
  182.  
  183. P1 demonstrated that our approach was promising. It was used to generate the data structures
  184. for the OPS5/LEAPS system, a compiler for OPS5 rules [10 ]. OPS5/LEAPS was chosen because
  185. ___________________________________________________1
  186.      We are also developing a third Predator compiler (P++ [9]) that will provide domain-independent language
  187. extensions to C++. We envision that P++ will be the ultimate platform on which to base future Predator research.
  188.  
  189.  
  190.  
  191.                                                         Thomas- 3
  192.  
  193.                _________________________________________________________________________________________________
  194.                _                                       _Unordered _      Unordered _     Sorted  _   Binary _
  195.                __Component_library_______________________linked_list___________array_______array_________tree____
  196.  
  197.                _ Booch Components 2.0-beta  _                    320  _           360 _      398  _      481  _
  198.                _ libg++ 2.4                        _             336  _           386 _      474  _      336  _
  199.                _ P1                                   _          281  _           281 _      287  _      285  _
  200.                __P2______________________________________________308______________310________316_________310____
  201.  
  202.  
  203.  
  204.                     Figure 1:  Code size (in words) of dictionary benchmark programs.
  205.  
  206.  
  207.                _________________________________________________________________________________________________
  208.                _                                       _Unordered _      Unordered _     Sorted  _   Binary _
  209.                __Component_library_______________________linked_list___________array_______array_________tree____
  210.  
  211.                _ Booch Components 2.0-beta  _                   70.9  _          54.6 _     11.1  _     15.4  _
  212.                _ libg++ 2.4                        _            41.9  _          34.3 _       5.4 _       4.1 _
  213.                _ P1                                   _         40.2  _          33.3 _       6.3 _       3.0 _
  214.                __P2_____________________________________________39.9_____________33.1_________5.9_________2.9___
  215.  
  216.  
  217.  
  218.                 Figure 2: Execution time (in seconds) of dictionary benchmark programs.
  219.  
  220.  
  221.  
  222. it demands high-performance and complex data structures. Preliminary experiments have shown
  223. that using P1 to generate OPS5/LEAPS code results in improved programmer productivity and
  224. executable code performance relative to hand written code. In the largest example attempted so
  225. far, P1 generated almost 7000 lines of C code whose performance was 20-30% better than that of
  226. OPS5/LEAPS. Reports on these experiments are forthcoming.
  227.  
  228.  
  229. P2 is a follow-on project to P1. It supports domain-specific extensions to ANSI C and provides a
  230. more modular and maintainable architecture than P1. P2 is a system that we plan to distribute.
  231.  
  232.  
  233. In  order  to  further  verify  the  productivity  and  executable  co de  p erformance  advantages  of  our
  234. approach, we used a simple benchmark2  totest programs using the Booch Components and libg++
  235. container classes against P1 and P2 generated container co de.
  236.  
  237.  
  238. Three observations regarding productivity were immediately apparent:
  239.  
  240.  
  241.  
  242.     fflThe size of the P1 and P2 programs were the same or smaller than corresponding implemen-
  243.        tations for the Booch C++ Components and libg++ (see Figure 1). The reason is that both
  244.        P1 and P2 offer high-level container abstractions that make programs compact and quicker
  245.        to write.
  246.  
  247.  
  248.     fflIt was trivial to alter container implementations in P1 and P2 programs. In general, only a
  249. ___________________________________________________2
  250.      Since we know of no commonly-used benchmark suites that can evaluate container libraries in terms of program-
  251. mer productivity and performance, we we devised our own benchmark. Our benchmark spell-checks a document
  252. (the 1600 word Declaration of Independence) against a dictionary of 25,000 words.  The main activities involved
  253. are inserting randomly ordered words of the dictionary into one container, inserting words of the target document
  254. into another container while eliminating duplicates,and printing those words of the document container that do not
  255. appear in the dictionary container.
  256.    We used the Booch Components, libg++, P1, and P2 to implement this benchmark using four different container
  257. implementations: unordered linked lists, unordered arrays, sorted arrays, and binary trees. The benchmarks were
  258. executed on a SPARCstation 1+ with24 MB of memory, running SunOS 4.1.2. The Booch Components code was
  259. compiled with Sun C++ 3.0.1 -O4, libg++ with G++ 2.4.5 -O2, and P1 and P2 with GCC 2.4.5 -O2.
  260.  
  261.  
  262.                                                         Thomas- 4
  263.  
  264.  
  265.        few lines of declarations needed to be changed; no executable lines were modified.
  266.  
  267.  
  268.     fflPrograms that used the Booch C++ Component and libg++ libraries required more extensive
  269.        modifications  when  container  implementations  were  altered.  Different  data  structures  had
  270.        either different interfaces or different names for semantically equivalent functions.
  271.  
  272.  
  273.  
  274. Also  observe  that  the  performance  of  P1  and  P2  code  is  comparable  to the  p erformance  of  the
  275. other programs (see Figure 2).
  276.  
  277.  
  278.  
  279. 3      Conclusion
  280.  
  281.  
  282.  
  283. Software  libraries  have  been  a  successful  means  of  achieving  component  reuse.   The  paradigm
  284. of  populating  a  library  with  components,  however,  is  potentially  very  brittle.   When  libraries
  285. contain components that each encapsulate several features, this is a symptom of a library that is
  286. unscalable_the number of combinations of features(and hence components) is exponential.  This
  287. is the case for libraries of data structures.
  288.  
  289.  
  290. We  believe  a  practical  alternative  to  unscalable  libraries  is  to  rebuild  these  libraries  to  contain
  291. components that encapsulate individual features. The library should be accompanied by a generator
  292. (or compiler) that will take a simple user-written specification of thefeatures of the target software,
  293. and will assemble that software automatically. We are showing that performance and productivity
  294. need  not  be  sacrificed  by  taking  a  generative  approach.   We  believe  software  generators  will  be
  295. important tools in the advancement of software reuse.
  296.  
  297.  
  298.  
  299. References
  300.  
  301.  
  302.  
  303.   [1] D. Lea, "libg++, the GNU C++ library," in Proceedings of the USENIX C++ Conference,
  304.       1988.
  305.  
  306.  
  307.   [2] G. Booch, Software Components with Ada.  Benjamin/Cummings, 1987.
  308.  
  309.  
  310.   [3] M. McIlroy, "Mass produced software components,"  in Proceedings of NATO Conference  on
  311.       Software Engineering, pp. 88-98, 1969.
  312.  
  313.  
  314.   [4] C. W. Krueger, "Software reuse," ACM Computing Surveys, June 1992.
  315.  
  316.  
  317.   [5] D. Batory, V. Singhal, and M. Sirkin, "Implementing a domain model for data structures,"
  318.       International Journal of Software Engineering and Know ledge Engineering, vol. 2, pp. 375-402,
  319.       September 1992.
  320.  
  321.  
  322.   [6] D. Batory and S. O'Malley, "The design and implementation of hierarchical software system
  323.       with  reusable  components," ACM  Transactions  on  Software  Engineering  and  Methodology,
  324.       October 1992.
  325.  
  326.  
  327.   [7] M. Sirkin, D. Batory, and V. Singhal, "Software components in a data structure precompiler,"
  328.       in Proceedings of the 15th International Conference on Software Engineering, May 1993.
  329.  
  330.  
  331.   [8] D. Batory, V. Singhal, M. Sirkin, and J. Thomas, "Scalable software libraries," in Proceedings
  332.       of  the  ACM  SIGSOFT  '93:  Symposium  on  the Foundations  of  Software  Engineering, (Los
  333.       Angeles, California), December 7-10 1993.
  334.  
  335.  
  336.                                                         Thomas- 5
  337.  
  338.  
  339.   [9] V.  Singhal  and  D.  Batory,  "P++: a  language  for  software  system  generators,"  Tech.  Rep.
  340.       TR-93-16, Department of Computer Sciences, The University of Texas at Austin, 1993.
  341.  
  342.  
  343. [10]  D. A. Brant and D. P. Miranker, "Index support for rule activation," in Proceedings of 1993
  344.       ACM SIGMOD, May 1993.
  345.  
  346.  
  347.  
  348. 4      Biography
  349.  
  350.  
  351.  
  352. Jeff Thomas is a graduate student in the Department of Computer Sciences at the University
  353. of  Texas, Austin.   He  received  his  B.S.  and  M.Eng.   from  Cornell  University  in  1989  and  1992
  354. respectively. His research interests include software engineering, databases, operating systems, and
  355. artificial intelligence.
  356.  
  357.  
  358. Don Batory is an Associate Professor in the Department of Computer Sciences at The University
  359. of Texas, Austin. He received his Ph.D. from the University of Toronto in 1980, he was Associate
  360. Editor of the IEEE Database Engineering Newsletter from 1981-84 and was Associate Editor of
  361. ACM Transactions on Database Systems from 1986-1991.  He is currently a member of the ACM
  362. Software Systems Award Committee,and his research interests are in extensible and object-oriented
  363. database management systems and large scale reuse.
  364.  
  365.  
  366. Vivek Singhal is a doctoral candidate in the Department of Computer Sciences at the Univer-
  367. sity  of  Texas, Austin.  He  received  his  S.B.  from  the  Massachusetts  Institute  of  Technology  in
  368. 1990. His research interests include reuse systems, domain modeling, and object-oriented database
  369. management systems.
  370.  
  371.  
  372. Marty Sirkin is a staff programmer at IBM Austin and a doctoral candidate at the University of
  373. Washington. He received his M.S. from the University of Washington in 1988, and his B.S. from the
  374. California Institute of Technology in 1984.  His research interests include reuse systems, distributed
  375. database management algorithms, and ease-of-use issues in user interface design.
  376.  
  377.  
  378.  
  379.                                                         Thomas- 6
  380.