Since the mid 70s or so design patterns have become a powerfull way of standardizing the static object model of a software application.
I manage that there seems to be less awareness or understanding that for certain patterns there exist language integrations.
For example since Microsoft Visual Basic 6 there exists the Keyword "Event". Using this single keyword you can define an observable object, and with another keyword (in vb.net it is 'Handles') you can define an Observer pattern in ~3 lines of code. Some years ago in c++ you may have written some hundred lines of code to do so.
Look at the Decorator pattern. This pattern in fundamental way does just the same thing which you can implement in Aspect oriented languages which gives you much more power than standard implementations of the pattern could provide.
Well, this whole thing is quite amazing. It boosts compactness of code to a quite high level. Compared to the code reduction you get generating Assembler code for a function or object this is quantum jump in the ongoing process of defining higher languages.
I hope that more language integrations for well known patterns will become popular and some day we'll have language-integration lists for various patterns.
The homogenity of languages goes on. Some years ago and nowadays industrial software projects may contain a dozens of proprietary interface definition languages and each step between languages or systems requires a lot of marshalling code which is not always generated. Think how many design patterns you use in one software project. May there be each or at least some design patterns implemented using a domain specific language or a special keyword? Well, using .NET Plattform you allready do it. Using Aspect J you allready do it.
I'm thinking of a list of language integrations of well known patterns but compared to the number of patterns there seem to exist not too much for now.
Pattern | Language integration |
GOF-Observer | Microsoft VisualBasic "Event" Keyword/other clr-syntaxes |
GOF-Decorator | Aspect oriented languages |
GOF-State | UML-Statemachine/other statemachines |
Reflection |
-Reflection-APIs of various languages (.NET/CLR, Java,c++ rtti ...) -Dynamic languages (in restricted way) |
Keine Kommentare:
Kommentar veröffentlichen