Creating Patterns

Writing your very own patterns isn't as hard as you might think, but it's not trivial either. You need a good idea — which is some solution that you've seen somewhere — and you need to dig deep to identify the trade-offs and forces that make it a hard problem (see Chapter 4) in order to understand why this is the best solution to the problem. After you get your pattern written, you should have it reviewed and share it with your colleagues so they can learn from what you've done.

images

For an in-depth look at all the sections that a pattern can contain, see Chapter 4.

Coming up with the idea

Anyone can be a pattern author, including you. In fact, many patterns are written by people just like you — people who see a solution more than once and think that someone else can learn from a written explanation of that solution.

Consider the pattern Model-View-Controller (MVC), which I discuss in Chapter 13. Most people know this pattern, which is used countless times each day in building and using systems. Writing a pattern like this one requires skill in the domain and skill to say to yourself, “I've seen this before. What problem does this pattern solve, and how can I explain the trade-offs that make it the best solution?”

Sometimes, a pattern isn't created from thin air but mined from software in the same way that gold is mined from the earth. The software pattern already exists. ...

Get Pattern-Oriented Software Architecture For Dummies now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.