Patterns-Based Engineering
Let's start with a short definition. PBE is
- a systematic, disciplined, and quantifiable approach to software development that leverages the use of pattern specifications and implementations throughout the software development and delivery process.10
When we dig into this definition, a number of key ideas surface:
- PBE augments the overall software development and delivery process. We take a wide view of how patterns support us in developing and delivering software.
- PBE unifies the use of patterns in their different forms, using pattern specifications as blueprints as well as using pattern implementations to automate the application of those blueprints.
- PBE focuses on the systematic, disciplined use of patterns while enabling us to quantify the impact of using the patterns.
Pattern Specifications and Pattern Implementations
Design patterns from the GoF book were the first patterns to gain significant attention. Since that time, many other patterns have been identified and documented, as evidenced by the large number of results from online pattern searches. Generally, these patterns are presented in formal, written documentation that explains the pattern. We refer to these documents as pattern specifications.
There is some variation in how pattern specifications appear, but the following information is usually included:
- The name of the pattern
- A description of the problem the pattern solves
- A description of the solution that the pattern provides
- A discussion of the consequences, the advantages and disadvantages, of applying the pattern
Pattern specifications provide a great deal of value, as they
- Support learning about the best-practice-based approach to a recurring problem
- Simplify communication, since the name of the pattern can be used in place of repeating all of the pattern details
- Enable people to easily read and learn about a pattern
- Detail a best-practice approach to solving a recurring problem
However, there are a number of limitations to just using pattern specifications:
- Pattern Users need to be aware of what patterns exist and how they can be applied.
- Because patterns are tailored to the context in which they are used, it is highly likely that each person who uses a pattern will create slightly different solutions.
- If a pattern needs to be reapplied to a solution, it is a manual effort to update all the areas of the solution that leverage the pattern.
- Because the pattern is applied manually, human error is likely to creep into the application of the pattern. Even a small percentage of errors become significant over a large number of applications.
- It is difficult for individuals and teams to use a selection of patterns together. All the complexity of the combination surfaces as we are unable to easily encapsulate and shield Pattern Users from such complexity.
With the limitations of pattern specifications in mind, we are left to wonder how tooling and automation could assist. To that end, we look to the idea of pattern implementations. A pattern implementation automates the application of a pattern in a particular environment. Thus, patterns become tools themselves, concrete artifacts within the development environment.
From a Pattern User perspective, there are a number of different ways in which a pattern implementation can be manifested. A pattern implementation may surface as a wizard, a model transformation, a UML pattern, a web page, or even something as simple as a right-click with the mouse.
Benefits of using pattern implementations include
- Increased productivity. Using pattern implementations simplifies and accelerates how we deliver software. We are able to automate our best practices, which allows us to dramatically reduce repetitive and manual efforts. In addition, we reduce the skill requirements for working with and applying a pattern correctly.
- Increased quality. Pattern implementations allow us to consistently create solutions that adhere to architectural, design, and coding standards. In addition, as the pattern implementation embodies our best-practice approach to solving a problem, we are by definition increasing the quality of our solutions.
- Better leveraging of skills and expertise. With a pattern implementation we are able to capture our best practices and then make them available to the rest of the team for reuse. Others easily reuse the expertise that goes into the pattern, without the need for the experience, trial and error, and research that went into creating the pattern.
- Improved governance. Not only are we able to use tooling to apply our best practices, but we can also check that the resulting solution adheres to these best practices.
- Reduced cost. We can reduce the cost of the solutions we build as we are able to be more productive, increase quality, better leverage skills, and improve the governance associated with best practices.