Design Patterns as Language Constructs.
Jan Bosch
Abstract
Jan Bosch
Abstract
Design patterns have proven to be very useful for the design of object-oriented systems. The power of design patterns stems from their ability to provide generic solutions to reappearing problems that can be specialised for particular situations. The implementation of design patterns, however, has received only little attention and we have identified four problems associated with the implementation of design patterns using conventional object-oriented languages. First, the traceability of a design pattern in the implementation is often insufficient; often the design pattern is ‘lost’. Second, since several patterns require an object to forward messages to other objects to increase flexibility, the self problem often occurs. Thirdly, since the pattern implementation is mixed with the domain class, the reusability of pattern implementations is often limited. Finally, implementing design patterns may present significant implementation overhead for the software engineer. Often, a, potentially large, number of simple methods has to be implemented with trivial behaviour, e.g. forwarding a message to another object. In this paper, a solution to these problems is presented in the context of the layered object model (LayOM). LayOM provides language support for the explicit representation of design patterns in the programming language. LayOM is an extended object-oriented language in that it contains several components that are not part of the conventional object model, such as states, categories and layers. Layers are used to represent design patterns at the level of the programming language and example layer types for eight design patterns are presented, i.e. Adapter, Bridge, Composite, Facade, State, Observer, Strategy andMediator. Since LayOM is an extensible language, the software engineer may extend the language model with abstractions for other design patterns. 1
OpenAlex reports 116 citations for this work. Citation counts describe recorded attention and do not establish research quality.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
Design patterns have proven to be very useful for the design of object-oriented systems. The power of design patterns stems from their ability to provide generic solutions to reappearing problems that can be specialised for particular situations. The implementation of design patterns, however, has received only little attention and we have identified four problems associated with the implementation of design patterns using conventional object-oriented languages. First, the traceability of a design pattern in the implementation is often insufficient; often the design pattern is ‘lost’. Second, since several patterns require an object to forward messages to other objects to increase flexibility, the self problem often occurs. Thirdly, since the pattern implementation is mixed with the domain class, the reusability of pattern implementations is often limited. Finally, implementing design patterns may present significant implementation overhead for the software engineer. Often, a, potentially large, number of simple methods has to be implemented with trivial behaviour, e.g. forwarding a message to another object. In this paper, a solution to these problems is presented in the context of the layered object model (LayOM). LayOM provides language support for the explicit representation of design patterns in the programming language. LayOM is an extended object-oriented language in that it contains several components that are not part of the conventional object model, such as states, categories and layers. Layers are used to represent design patterns at the level of the programming language and example layer types for eight design patterns are presented, i.e. Adapter, Bridge, Composite, Facade, State, Observer, Strategy andMediator. Since LayOM is an extensible language, the software engineer may extend the language model with abstractions for other design patterns. 1
Key concepts: Software design pattern, Structural pattern, Computer science, Programming language, Object-oriented design, Pattern language (formal languages), Design pattern, Design language