Modularization constructs for functional and object-oriented languages

Gerald Baumgartner, Purdue University

Abstract

Design patterns are distilled from many real systems to catalog common programming practice. We have analyzed several published design patterns looking for patterns of working around constraints of the implementation programming language. Some object-oriented design patterns are distorted or overly complicated because of the lack of supporting language constructs or mechanisms. We lay a groundwork of general-purpose language constructs and mechanisms that, if provided by a statically typed, object-oriented language, would better support the implementation of design patterns and, thus, benefit the construction of many real systems. In particular, our catalog of language constructs includes subtyping separate from inheritance, lexically scoped closure objects independent of classes, and multimethod dispatch. The proposed constructs and mechanisms are not radically new, but rather are adopted from a variety of languages and combined in a new, orthogonal manner. We argue that by describing design patterns in terms of the proposed constructs and mechanisms, pattern descriptions become simpler and, therefore, accessible to a larger number of language communities. Constructs and mechanisms lacking in a particular language could be implemented using paradigmatic idioms. We demonstrate with a case study that the proposed language constructs and mechanisms can be implemented efficiently. We describe our design and detail the implementation of a conservative C++ extension for abstracting types and for decoupling subtyping and inheritance. This extension gives the user more of the flexibility of dynamic typing while retaining the efficiency and security of static typing. After a discussion of syntax and semantics of this language extension and examples of its use, we present and analyze three different implementation techniques: a preprocessor to a C++ compiler, our implementation in the front end of a C++ compiler, and a low-level implementation with back-end support. We follow with an analysis of the performance of the three implementation techniques and show that our extension actually allows subtype polymorphism to be implemented more efficiently than with virtual functions. We conclude with a discussion of how to combine implementations of the proposed language constructs and mechanisms, a discussion of the lessons we learned for future programming language design, and directions for future work.

Degree

Ph.D.

Advisors

Russo, Purdue University.

Subject Area

Computer science

Off-Campus Purdue Users:
To access this dissertation, please log in to our
proxy server
.

Share

COinS