Designing families of data types using exemplars

ACM Transactions on Programming Languages and Systems - Tập 11 Số 2 - Trang 212-248 - 1989
Wilf R. LaLonde1
1Carleton Univ., Ottawa, Canada

Tóm tắt

Designing data types in isolation is fundamentally different from designing them for integration into communities of data types, especially when inheritance is a fundamental issue. Moreover, we can distinguish between the design of families—integrated types that are variations of each other—and more general communities where totally different but cohesive collections of types support specific applications (e.g., a compiler). We are concerned with the design of integrated families of data types as opposed to individual data types; that is, on the issues that arise when the focus is intermediate between the design of individual data types and more general communities of data types. We argue that design at this level is not adequately served by systems providing only class-based inheritance hierarchies and that systems which additionally provide a coupled subtype specification hierarchy are still not adequate. We propose a system that provides an unlimited number of uncoupled specification hi erarchies and illustrate it with three: a subtype hierarchy, a specialization/generalization hierarchy, and a like hierarchy. We also resurrect a relatively unknown Smalltalk design methodology that we call programming-by-exemplars and argue that it is an important addition to a designer's grab bag of techniques. The methodology is used to show that the subtype hierarchy must be decoupled from the inheritance hierarchy, something that other researchers have also suggested. However, we do so in the context of exemplar-based systems to additionally show that they can already support the extensions required without modification and that they lead to a better separation between users and implementers, since classes and exemplars can be related in more flexible ways. We also suggest that class-based systems need the notion of private types if they are to surmount their current limitations. Our points are made in the guise of designing a family of List data types. Among these is a new variety of lists that have never been previously published: prefix-sharing lists. We also argue that there is a need for familial classes to serve as an intermediary between users and the members of a family.

Từ khóa


Tài liệu tham khảo

AGHA , G. Actors: A Model of Concurrent Computation in Distributed Systems . MIT Press , Cambridge, Mass ., 1986 . AGHA, G. Actors: A Model of Concurrent Computation in Distributed Systems. MIT Press, Cambridge, Mass., 1986.

AMERICA , P. Inheritance and subtyping in a parallel object-oriented language . In European Conference on Object-Oriented Programming '87 ( Paris , June 1987 ), 281 - 289 . AMERICA, P. Inheritance and subtyping in a parallel object-oriented language. In European Conference on Object-Oriented Programming '87 (Paris, June 1987), 281-289.

BLACK , A. , HUTCHINSON , N. , JUL , E. , AND LEVY , H. Object structure in the Emerald system. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 78 - 86 . 10.1145/28697.28706 BLACK, A., HUTCHINSON, N., JUL, E., AND LEVY, H. Object structure in the Emerald system. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 78-86. 10.1145/28697.28706

BOBROW , D. G. , KAHN , K. , KICZALES , G. , MASINTER , L. , STEFIK , M. , AND ZDYBEL , F. CommonLoops : Merging common Lisp and object-oriented programming. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 17 - 29 . 10.1145/28697.28700 BOBROW, D. G., KAHN, K., KICZALES, G., MASINTER, L., STEFIK, M., AND ZDYBEL, F. CommonLoops: Merging common Lisp and object-oriented programming. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 17-29. 10.1145/28697.28700

10.1145/357146.357147

BORNING , g. Classes versus prototypes in object-oriented languages . In Proceedings of the ACM/IEEE Fall Joint Computer Conference (Dallas, Tex. , Nov. 1986 ), 36 - 40 . BORNING, g. Classes versus prototypes in object-oriented languages. In Proceedings of the ACM/IEEE Fall Joint Computer Conference (Dallas, Tex., Nov. 1986), 36-40.

BUDD , T. A Little SmaUtalh. Addison-Wesley, Reading , Mass. , 1987 . BUDD, T. A Little SmaUtalh. Addison-Wesley, Reading, Mass., 1987.

BYRD , R. J. , SMITH , S. E. , AND DE JONG , S.P. An actor-based programming system . In ACM SIGOA Conference on Office Information Systems ( Univ. of Pennsylvania, Philadelphia , June 1982 ), 21 - 23 . 10.1145/800210.806479 BYRD, R. J., SMITH, S. E., AND DE JONG, S.P. An actor-based programming system. In ACM SIGOA Conference on Office Information Systems (Univ. of Pennsylvania, Philadelphia, June 1982), 21-23. 10.1145/800210.806479

COINTE , P. Metaclasses are first class: The ObjVlisp model. In Object-Oriented Programming Systems , Languages and Applications '87 (Orlando, Fla. , Oct. 1987 ), 156 - 167 . 10.1145/38765.38822 COINTE, P. Metaclasses are first class: The ObjVlisp model. In Object-Oriented Programming Systems, Languages and Applications '87 (Orlando, Fla., Oct. 1987), 156-167. 10.1145/38765.38822

Cox, B. Object-Oriented Programming: An Evolutionary Approach . Addison-Wesley , Reading, Mass ., 1986 . Cox, B. Object-Oriented Programming: An Evolutionary Approach. Addison-Wesley, Reading, Mass., 1986.

Cox, B. Message/object programming : An evolutionary change in programming technology . IEEE Softw. I , 1 ( Jan. 1984 ), 50 - 61 . Cox, B. Message/object programming: An evolutionary change in programming technology. IEEE Softw. I, 1 (Jan. 1984), 50-61.

DEREMER , F. , AND KRON , $ . Programming-in-the-large versus programming-in-the-small . IEEE Trans. Softw. Eng. SE-2 ( June 1976 ), 80 - 86 . DEREMER, F., AND KRON, $. Programming-in-the-large versus programming-in-the-small. IEEE Trans. Softw. Eng. SE-2 (June 1976), 80-86.

DUFF , C. Neon--Extending Forth in new directions . In Proceedings of 1984 Asilomar FORML Conference , 1984 . DUFF, C. Neon--Extending Forth in new directions. In Proceedings of 1984 Asilomar FORML Conference, 1984.

FUKUNAGA , K. , AND H1 ROSE , S. Experience with a Prolog-based object-oriented language. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 224 - 231 . 10.1145/28697.28719 FUKUNAGA, K., AND H1ROSE, S. Experience with a Prolog-based object-oriented language. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 224-231. 10.1145/28697.28719

GOLDBERG , A. , AND ROBSON , D. SmaUtalk-80: The Language and Its Implementation . Addison- Wesley , Reading, Mass ., 1983 . GOLDBERG, A., AND ROBSON, D. SmaUtalk-80: The Language and Its Implementation. Addison- Wesley, Reading, Mass., 1983.

GOLDBERG , A. Smalltalh-80: The Interactive Programming Environment . Addison-Wesley , Reading, Mass ., 1984 . GOLDBERG, A. Smalltalh-80: The Interactive Programming Environment. Addison-Wesley, Reading, Mass., 1984.

HALBERT , D. , AND O'BRIEN , P. Using types and inheritance in object-oriented languages . In European Conference on Object-Oriented Programming '87 ( Paris , June 1987 ), 23 - 34 . HALBERT, D., AND O'BRIEN, P. Using types and inheritance in object-oriented languages. In European Conference on Object-Oriented Programming '87 (Paris, June 1987), 23-34.

HALBERT , D. , AND O'BRIEN , P. Using types and inheritance in object-oriented programming . IEEE Softw . ( Sept. 1987 ), 71-79. HALBERT, D., AND O'BRIEN, P. Using types and inheritance in object-oriented programming. IEEE Softw. (Sept. 1987), 71-79.

INGALLS , D. H. H. A simple technique for handling multiple polymorphism. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 347 - 349 . 10.1145/28697.28732 INGALLS, D. H.H. A simple technique for handling multiple polymorphism. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 347-349. 10.1145/28697.28732

KAEHLER , T. , AND PATTERSON , D. A Taste of Smalltalh . Norton , New York , 1986 . KAEHLER, T., AND PATTERSON, D. A Taste of Smalltalh. Norton, New York, 1986.

KRASNER , G. SmaUtalk-80: Bits of History , Words of Advice . Addison-Wesley , Reading, Mass ., 1983 . KRASNER, G. SmaUtalk-80: Bits of History, Words of Advice. Addison-Wesley, Reading, Mass., 1983.

LAFF , M.R. Smallworld--An object-based programming system. IBM Res. Rep. RC-9022 , IBM Thomas J. Watson Research Center, Yorktown Heights , N.Y. , 1981 . LAFF, M.R. Smallworld--An object-based programming system. IBM Res. Rep. RC-9022, IBM Thomas J. Watson Research Center, Yorktown Heights, N.Y., 1981.

LALONDE , W. R. , THOMAS , D. A. , AND PUGH , J.R. An exemplar based Smalltalk. In Object- Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 322 - 330 . 10.1145/28697.28729 LALONDE, W. R., THOMAS, D. A., AND PUGH, J.R. An exemplar based Smalltalk. In Object- Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 322-330. 10.1145/28697.28729

r ANG , $. Z. , AND PEARLMUTTER , $. A. Oaklisp : An object-oriented scheme with first class types. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 30 - 37 . 10.1145/28697.28701 rANG, $. Z., AND PEARLMUTTER, $. A. Oaklisp: An object-oriented scheme with first class types. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 30-37. 10.1145/28697.28701

LIEBERMAN , H. A preview of Act 1. MIT AI Lab. Memo 625, June 1981 . LIEBERMAN, H. A preview of Act 1. MIT AI Lab. Memo 625, June 1981.

LIEBERMAN , H. Using prototypical objects to implement shared behavior in object oriented systems. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 214 - 223 . 10.1145/28697.28718 LIEBERMAN, H. Using prototypical objects to implement shared behavior in object oriented systems. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 214-223. 10.1145/28697.28718

MOON , D. A. Object-oriented programming with flavors. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 1 - 8 . 10.1145/28697.28698 MOON, D. A. Object-oriented programming with flavors. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 1-8. 10.1145/28697.28698

O'BRIEN , P. D. , HALBERT , D. C. , AND KILIAN , U.F. The Trellis programming environment. In Object-Oriented Programming Systems , Languages and Applications '87 (Orlando, Fla. , Oct. 1987 ), 91 - 102 . 10.1145/38765.38815 O'BRIEN, P. D., HALBERT, D. C., AND KILIAN, U.F. The Trellis programming environment. In Object-Oriented Programming Systems, Languages and Applications '87 (Orlando, Fla., Oct. 1987), 91-102. 10.1145/38765.38815

O'SHEA , T. The learnability of object-oriented programming systems. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 502 - 504 . O'SHEA, T. The learnability of object-oriented programming systems. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 502-504.

PUGH , J. R. , AND LAZONDE , W.R. Data structures and data types: An object-oriented approach. In Canadian Information Processing Society , Congress '86 ( Vancouver, B.C. , April 1986 ), 251 - 258 . PUGH, J. R., AND LAZONDE, W.R. Data structures and data types: An object-oriented approach. In Canadian Information Processing Society, Congress '86 (Vancouver, B.C., April 1986), 251-258.

SCHAFFERT , C. , COOPER , T. , BULLIS , B. , KILIAN , M. , AND WILPOLT , C. An introduction to Trellis/Owl. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 9 - 16 . 10.1145/28697.28699 SCHAFFERT, C., COOPER, T., BULLIS, B., KILIAN, M., AND WILPOLT, C. An introduction to Trellis/Owl. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 9-16. 10.1145/28697.28699

SCHMUCKER , K.J. Object-Oriented Programming for the Macintosh. Hayden , Rochelle Park , N.J. , 1986 . SCHMUCKER, K.J. Object-Oriented Programming for the Macintosh. Hayden, Rochelle Park, N.J., 1986.

SHAPIRO , E. Y. , AND TAKEUCHI , A. Object-Oriented Programming in Concurrent Prolog . Vol. 1 , New Generation Computing, OHMSHA Ltd., and Springer , 1983 , 25-48. SHAPIRO, E. Y., AND TAKEUCHI, A. Object-Oriented Programming in Concurrent Prolog. Vol. 1, New Generation Computing, OHMSHA Ltd., and Springer, 1983, 25-48.

SMITH , B. Reflections and semantics in a procedural language. MIT Lab. for Computer Science Rep. MIT-TR-272 , 1982 . SMITH, B. Reflections and semantics in a procedural language. MIT Lab. for Computer Science Rep. MIT-TR-272, 1982.

SNYDER , A. Encapsulation and inheritance in object-oriented systems. In Object-Oriented Programming Systems , Languages and Applications '86 (Portland, Ore. , Sept. 1986 ), 38 - 45 . 10.1145/28697.28702 SNYDER, A. Encapsulation and inheritance in object-oriented systems. In Object-Oriented Programming Systems, Languages and Applications '86 (Portland, Ore., Sept. 1986), 38-45. 10.1145/28697.28702

SNYDER , A. Inheritance and the development of encapsulated software components . In Proceedings of HICSS-20 ( 1987 ), 227 - 237 . SNYDER, A. Inheritance and the development of encapsulated software components. In Proceedings of HICSS-20 (1987), 227-237.

STEFIK , M. J. , AND BOBROW , n. G. Object-oriented programming : Themes and variations . AI Mag. 6 , 4 ( 1986 ), 40-62. STEFIK, M. J., AND BOBROW, n. G. Object-oriented programming: Themes and variations. AI Mag. 6, 4 (1986), 40-62.

STEIN , L.A. Delegation is inheritance. In Object-Oriented Programming Systems , Languages and Applications '87 (Orlando, Fla. , Oct. 1987 ), 91 - 102 . 10.1145/38765.38820 STEIN, L.A. Delegation is inheritance. In Object-Oriented Programming Systems, Languages and Applications '87 (Orlando, Fla., Oct. 1987), 91-102. 10.1145/38765.38820

STROUSTRUP , B. The C++ Programming Language . Addison-Wesley , Reading, Mass ., 1986 . STROUSTRUP, B. The C++ Programming Language. Addison-Wesley, Reading, Mass., 1986.

STROUSTRUP , B. What is object-oriented programming? In European Conference on Object- Oriented Programming '87 ( Paris , June 1987 ), 57 - 76 . STROUSTRUP, B. What is object-oriented programming? In European Conference on Object- Oriented Programming '87 (Paris, June 1987), 57-76.

TESLER , L. Object-Pascal report . Apple Computer , Feb. 1984 . TESLER, L. Object-Pascal report. Apple Computer, Feb. 1984.

THOMAS , D. A. , AND LALONDE , W. R. Actra : The design of an industrial fifth generation Smalltalk system . In Proceedings of IEEE COMPINT '85 , (Montreal, Sept. 1985 ) 138 - 140 . THOMAS, D. A., AND LALONDE, W. R. Actra: The design of an industrial fifth generation Smalltalk system. In Proceedings of IEEE COMPINT '85, (Montreal, Sept. 1985) 138-140.

UNGAR , D. , AND SMITH , R.B. Self : The power of simplicity. In Object-Oriented Programming Systems , Languages and Applications '87 (Orlando, Fla. , Oct. 1987 ), 227 - 240 . 10.1145/38765.38828 UNGAR, D., AND SMITH, R.B. Self: The power of simplicity. In Object-Oriented Programming Systems, Languages and Applications '87 (Orlando, Fla., Oct. 1987), 227-240. 10.1145/38765.38828

WEGNER , P. Workshop on object-oriented programming. European Conference on Object- Oriented Programming '87 ( Paris , June 1987 ). In SIGPLAN Not. 23, i (Jan. 1988), 16 - 37 . 10.1145/44304.44305 WEGNER, P. Workshop on object-oriented programming. European Conference on Object- Oriented Programming '87 (Paris, June 1987). In SIGPLAN Not. 23, i (Jan. 1988), 16-37. 10.1145/44304.44305

WEGNER , P. Dimensions of object-based language design. In Object-Oriented Programming Systems , Languages and Applications '87 (Orlando, Fla. , Oct. 1987 ), 168 - 182 . 10.1145/38765.38823 WEGNER, P. Dimensions of object-based language design. In Object-Oriented Programming Systems, Languages and Applications '87 (Orlando, Fla., Oct. 1987), 168-182. 10.1145/38765.38823

ZANIOLO , C. Object-oriented programming in Prolog . In 1984 International Symposium on Logic Programming (Feb. 1984 ), 265 - 271 . ZANIOLO, C. Object-oriented programming in Prolog. In 1984 International Symposium on Logic Programming (Feb. 1984), 265-271.