Chapter 9

Modelling Design Motifs

The previous chapters were concerned with the problem of modelling specific programs and class libraries, small and big. This chapter is concerned with a different problem: that of modelling design motifs such as design patterns and application frameworks. Below we examine the requirements posed by the principle of genericity (§3.6). We discuss design motifs and try and understand why modelling them poses a different set of problems to those encountered so far. This discussion will motivate the introduction of variables into our design description language.

We take a design motif to be a blueprint or a template, an abstraction that can be implemented in (at least in principle) an unbounded number of ways—the word “pattern” comes to mind except that this term has become rather specialized (see §10.2). Design motifs are not programs; they are abstractions of programs. For example, the Widget Factory (§8.5) is said to implement the Abstract Factory design pattern, but there is an unbounded number of other possible implementations of the same pattern. Therefore, we think of design patterns such as the Abstract Factory as design motifs.

How should design motifs be modelled? The constants introduced in the previous chapters represent specific parts of specific programs: classes, methods, and sets thereof. Design motifs are not any part of any specific programs. Therefore the problem of modelling design motifs is fundamentally different from the problem ...

Get Codecharts: Roadmaps and blueprints for object-oriented programs now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.