Last updated: 2002-11-18 [Single page version] [Japanese version]
We have made a catalog of design pattern improvement achieved by MixJuice language. This catalog is useful not only for MixJuice programmers, but also AspectJ, CLOS and Ruby programmers. (See the section of For other programming languages for details.)
Here is a table that shows which kind of problems of each design pattern are resolved by the basic programming techniques of MixJuice. (We recommend you read Adapter, Decorator and Visitor.)
Meanings of abbreviations:
I or A (See the section of An improvement of the solution or another solution for details):
Resolved problems (See the section of Categories of resolved problems for details):
Whether mentioned in the GoF book or not:
Used Techniques (See the page of Programming techniques of MixJuice for details):
"I" means it is an improvement of the solution. MixJuice can resolve problems of GoF patterns without changing their class structure. In this case, all merits of GoF patterns are inherited to the improved solutions.
"A" means it is another solution whose class structure is different from the corresponding GoF pattern. There may be merits and demerits compared with the original GoF pattern.
The original GoF pattern can not be introduced to the existing program without modifying the source code.
The original GoF pattern does not support some kind of extensions without modifying the source code.
The original GoF pattern forces some names to be public. (Some of these problems can be resolved by the package/nested-class mechanisms of Java.)
The original GoF pattern requires downcast to a subclass in order to invoke the methods of the subclass.
The class structure of the original GoF pattern is complicated and error prone.
Each solution in this catalog is explained using a "layered class diagram" and a pseudo code of MixJuice.
Layered class diagrams express how programs are extended by difference-based modules of MixJuice.
For more details, please see the proposal of layered class diagram.
This catalog contains quoations from the GoF book, "Design Patterns", Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides.
"Intent" of each design pattern are directly quoted from the GoF book.
Each class diagram has been re-written to adapt to the recent notation of UML.
Many of solutions in this catalog can be applicable to other AOP(aspect-oriented programming) or open-class languages, such as AspectJ, CLOS and Ruby.
Many of the programming techniques of MixJuice have corresponding programming techniques of such languages. Here is a table that shows correspondence between techniques of MixJuice and techniques of AspectJ, CLOS and Ruby.
| Techniques | AspectJ | CLOS | Ruby |
| method-ext | around advice | alias/def | |
| interface-add | declare parents | defmethod | include |
| field-add | introduction | assignment | |
| method-add | introduction | defmethod | dynamic method definition |
| abst-method-add | introduction | useless because dynamic typing | |
| namespace-sep | aspect | package | |
| sep-spec-impl | |||
| impl-selection | aspect selection | require selection | |
Some documents of other languages and systems explains how they make some of Design Patterns unnecessary. See the following pages.
Their programming style is quite different from ours. They do not much use introduction feature; however, we use introduction only.
Comments are welcome. Plese send mail to <akr@m17n.org>.