How to Access Patterns

From WikiContent

(Difference between revisions)
Jump to: navigation, search
Line 11: Line 11:
The strength of a pattern is not just the solution. It also provides insights on why this is a good solution. And it gives you information not only on the benefits, but also on possible liabilities. A pattern allows you and your peers to make well-informed decisions. It can make all the difference between "this is how it is done" (a stale attitude that prevents new ideas and change) and "this is how and why it is done here" (an attitude that is aware of a world outside of the acquired habits and open to evaluation and learning).
The strength of a pattern is not just the solution. It also provides insights on why this is a good solution. And it gives you information not only on the benefits, but also on possible liabilities. A pattern allows you and your peers to make well-informed decisions. It can make all the difference between "this is how it is done" (a stale attitude that prevents new ideas and change) and "this is how and why it is done here" (an attitude that is aware of a world outside of the acquired habits and open to evaluation and learning).
-
Patterns are useful; the hard part is using them. Hard problems will come up all of a sudden, and your peers will not wait for someone to claim "I'll find a pattern for this, give me a week to search." You need to have pattern knowledge before you actively consider using one. This is the hard part: Not only does it require lots of work in advance (and patterns often are not the most enjoyable pieces of literature), it also violates how humans learn — when applying some solution, or at least linking the stuff we read to some experience already present in our brain.
+
Patterns are useful; the hard part is using them. A problem will come up all of a sudden, and your peers will not wait for someone to claim "I'll find a pattern for this, give me a week to search." You need to have pattern knowledge before you actively consider using one. This is the hard part: Not only does it require lots of work in advance (and patterns often are not the most enjoyable pieces of literature), it also violates how humans often learn — applying some solution, or at least linking the stuff we read, to some experience already present in our brain.
This is why I suggest a three-pass reading style for patterns.
This is why I suggest a three-pass reading style for patterns.
-
# the name and the first sentence of the solution;
 
-
# the problem, the solution and the consequences;
 
-
# everything including implementation aspects and examples.
 
-
The first pass I do with every pattern I come across, and this is quite a few. It takes seconds, and you get an impression of what this pattern is all about. Your impression may be mislead, but that is ok for now. When some discussion pops up in your project, you will remember such a pattern and you'll be ready for the second pass.
+
# The name and the first sentence of the solution.
-
Isn't it a bit late by then? Not necessarily: before some problem needs to be solved urgently, most projects have some warning time. If you are aware of what is going on around your desk and task, you will be ahead just a bit - and this is sufficient.
+
# The problem, the solution, and the consequences.
 +
# Everything, including implementation aspects and examples.
-
The second pass is meant to give you all the ammunition you need in the heat of a design discussion. You will be able to judge proposals, and to propose some pattern yourself - or not to propose it. This will bring the team forward. Take some care of the pattern name in this phase. Depending on the team culture, the name may not ring a bell, and it is better then to just explain the idea of the solution.
+
The first pass I do with every pattern I come across. It takes only a few seconds, but you get an impression of what this pattern is all about. Your impression may be off target, but that is OK for now. When some discussion pops up in your project, you will remember such a pattern and you'll be ready for the second pass. Isn't it a bit late by then? Not necessarily. Before a problem becomes urgent, most projects have some warning time. If you are aware of what is going on around your desk and task, you will be ahead just a bit — and this is sufficient.
-
The third pass is in order when you have decided on some pattern and you need to implement it. If you are a bit like me, you wouldn't stand to read 30+ pages of some pattern before you are certain to implement it. Pass one includes a paragraph at most and involves a minute. Pass two requires to understand about 2 pages of printed paper and can hardly be done in less than 15 minutes. Pass three requires hours, but his is productive work time then.
+
The second pass is meant to give you all the ammunition you need in the heat of a design discussion. You will be able to judge proposals, and to propose some pattern yourself — or not to propose it. This will take the team forward. Be careful with the pattern name in this phase. Depending on the team background, the name may not ring any bells. In such cases it is better to just explain the idea of the solution than to focus on its name.
 +
 
 +
The third pass for when you have decided on some pattern and you need to implement it. If you are like me, you probably won't want to read 30+ pages of some pattern before you are certain it's relevant to you.
 +
 
 +
The first pass involves a paragraph at most and takes a minute. The second pass requires understanding about two pages and probably around 15 minutes. The third pass requires hours, but this is productive work time.
-
There is a whole bunch of knowledge available how to write your own pattern and how patterns can be used to capture parts of the knowledge of your team and company. But this is a different story and shall be written another time.
 
By [[Klaus Marquardt]]
By [[Klaus Marquardt]]

Revision as of 14:18, 7 August 2009

Patterns document knowledge that many developers and projects share. If you know a fair number of them, you will be able to find better solutions faster.

To support such a strong claim, take a look at the typical contents of a pattern. While many authors have their individual style and preference, these elements will be there in some form or other:

  1. A name
  2. A problem to be solved
  3. A solution
  4. Some rationale for the appropriateness of the solution
  5. Some analysis of the applied solution

The strength of a pattern is not just the solution. It also provides insights on why this is a good solution. And it gives you information not only on the benefits, but also on possible liabilities. A pattern allows you and your peers to make well-informed decisions. It can make all the difference between "this is how it is done" (a stale attitude that prevents new ideas and change) and "this is how and why it is done here" (an attitude that is aware of a world outside of the acquired habits and open to evaluation and learning).

Patterns are useful; the hard part is using them. A problem will come up all of a sudden, and your peers will not wait for someone to claim "I'll find a pattern for this, give me a week to search." You need to have pattern knowledge before you actively consider using one. This is the hard part: Not only does it require lots of work in advance (and patterns often are not the most enjoyable pieces of literature), it also violates how humans often learn — applying some solution, or at least linking the stuff we read, to some experience already present in our brain.

This is why I suggest a three-pass reading style for patterns.

  1. The name and the first sentence of the solution.
  2. The problem, the solution, and the consequences.
  3. Everything, including implementation aspects and examples.

The first pass I do with every pattern I come across. It takes only a few seconds, but you get an impression of what this pattern is all about. Your impression may be off target, but that is OK for now. When some discussion pops up in your project, you will remember such a pattern and you'll be ready for the second pass. Isn't it a bit late by then? Not necessarily. Before a problem becomes urgent, most projects have some warning time. If you are aware of what is going on around your desk and task, you will be ahead just a bit — and this is sufficient.

The second pass is meant to give you all the ammunition you need in the heat of a design discussion. You will be able to judge proposals, and to propose some pattern yourself — or not to propose it. This will take the team forward. Be careful with the pattern name in this phase. Depending on the team background, the name may not ring any bells. In such cases it is better to just explain the idea of the solution than to focus on its name.

The third pass for when you have decided on some pattern and you need to implement it. If you are like me, you probably won't want to read 30+ pages of some pattern before you are certain it's relevant to you.

The first pass involves a paragraph at most and takes a minute. The second pass requires understanding about two pages and probably around 15 minutes. The third pass requires hours, but this is productive work time.


By Klaus Marquardt

This work is licensed under a Creative Commons Attribution 3


Back to 97 Things Every Programmer Should Know home page

Personal tools