Types of Pattern Implementations
Earlier we discussed the difference between pattern specifications and pattern implementations. In this posting we’ll take a brief look at three types of pattern implementations. In classifying the types of pattern implementations our focus is on the types of artifacts that serve as input and output for the pattern implementation.
The first type of pattern implementation is related to UML modeling. A UML pattern implementation is typically applied within a UML model, makes changes to that same model – leading to existing elements within that model being updated or to the creation of new elements within the model. The scope of this pattern is rather limited – as you impact elements within a single model. The goal of using this type of pattern implementation is to add details to the current model. As a result the impact of the pattern is captured within the model. The resulting model can then be used as a blueprint or may end up serving as input for one of the other types of pattern implementations or a code generator.
Model-to-model pattern implementations represent a second type of pattern implementations. In this case we look to take a model as input and generate another model as output. We may act upon all of the model elements, or just a subset – but the scope is usually much broader than that of the UML pattern implementation. In addition – we see that the input and output models are distinct elements. The models may be UML based, EMF-based or based on a Domain Specific Language created using other means. The goal with this type of pattern implementation is to move between levels of abstraction. That is, we may be trying to go from a model at a higher level of abstraction to a model that is more concrete (i.e. closer to the implementation), or we may be moving in the opposite direction – from concrete to abstract.
Model-to-text pattern implementations represent a third type of pattern implementations. Much like model-to-model pattern implementation we see that the input and output elements are distinct. The difference in this case, is that although we take a model as input, the output is a set of one or more text based artifacts. These artifacts may be code, documentation, deployment scripts, configuration files or any other text based artifact.