Pattern Instance Notation – Another Approach for Modeling Patterns
We’ve talked about modeling pattern definitions and instantiations via the use of UML (Part 1, Part 2 and Part 3). These approaches provide information about how we’ve used patterns in creating solutions and since UML is widely supported, we can use this approach in our choice of UML tools. However, as UML is a general-purpose modeling language – we use and interpret standard, general elements to mean specific things when applied to patterns. Wouldn’t it be outstanding if there was a set of pattern-specific modeling constructs?
One pattern-specific approach to consider is the Pattern Instance Notation (PIN). It is still in its early days, but work is progressing on promoting this approach (including standardization\integration via the Object Management Group). Let’s take a look at this notation.
Starting with the simplest case, the following image shows the use of PIN to denote an instance of a pattern.
If we take things a step further, we specify the pattern and its associated roles, as shown in the next figure.
Within our solution we would then connect elements to the roles that they fulfill. PIN keeps things simple and focused on the relationship between the pattern, its roles and the solution elements that bind to those roles.
If we have compound patterns, we can use PIN as shown in the next figure.
If desired, UML can be used within the construct to provide further details on how the solution is realized.
To better understand how a pattern would be modeled using PIN, let’s take a look at a specific pattern – the Subsystem Façade pattern. As you’ll recall, this is a pattern that we identified, designed and developed in the PBE book. The following diagram shows how we’ve modeled the pattern using UML.
And here’s how the same pattern would be represented using PIN.
Additional Details on PIN can be found in
- Jason McC. Smith, The Pattern Instance Notation: A Simple Hierarchical Visual Notation for the Dynamic Visualization and Comprehension of Software Patterns, Journal of Visual Languages and Computing (2011), doi:10.1016/j.jvlc.2011.03.003.
- “The Pattern Instance Notation: A Simple Hierarchical Visual Notation for the Dynamic Visualization and Comprehension of Software Patterns” by Jason McC. Smith as published in the Electronic Communications of the EASST Volume 25 (2010) – Proceedings of the Workshop Visual Formalisms for Patterns at VL/HCC 2009.
Thanks to Jason for his input on this posting, allowing reuse of his sample images depicting PIN notation and access to the PIN stencil.