How to Access Patterns

From WikiContent

(Difference between revisions)
Jump to: navigation, search
(New page: Patterns document knowledge that many developers and projects share. If you know a fair amount of them, you will be able to find better solutions quicker. To support such a strong claim, ...)
Current revision (21:36, 7 August 2009) (edit) (undo)
 
(4 intermediate revisions not shown.)
Line 1: Line 1:
-
Patterns document knowledge that many developers and projects share. If you know a fair amount of them, you will be able to find better solutions quicker.
+
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 contents of patterns. While many authors have their individual style and preference, these elements will be there in some form or other:
+
To support such a strong claim, take a look at the typical contents of a pattern (each book varies in its presentation, but these elements will be present):
-
# a name
+
-
# a problem to be solved
+
-
# a solution
+
-
# some argueing about the appropriateness of the solution
+
-
# 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. So when you start some discussion in your team about how to solve a problem at hand, you have all the arguments with you. 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 it is done here" (an attitude that is aware of a world outside of the acquired habits and open to evaluation and learning).
+
# A name
 +
# A problem to be solved
 +
# A solution
 +
# Some rationale for the appropriateness of the solution
 +
# Some analysis of the applied solution
-
Now that patterns are ultimately useful, the hard part is to enable yourself to use 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.
+
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 we do this 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 contradicts how most humans learn — by applying some solution and observing what happens. At the very least, we need some linkage from 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 first pass I'd 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 (remember, applying a particular pattern is not unconditionally good). Both 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.
 +
 
 +
Hold back the third pass for when you have decided on some pattern and you need to implement it. If you are like me, you probably don'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. With these reading styles you will be able to make the most of patterns.
 +
 
 +
 
 +
By [[Klaus Marquardt]]
 +
 
 +
This work is licensed under a [http://creativecommons.org/licenses/by/3.0/us/ Creative Commons Attribution 3]
-
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 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.
 
-
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.
+
Back to [[97 Things Every Programmer Should Know]] home page

Current revision

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 (each book varies in its presentation, but these elements will be present):

  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 we do this 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 contradicts how most humans learn — by applying some solution and observing what happens. At the very least, we need some linkage from 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'd 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 (remember, applying a particular pattern is not unconditionally good). Both 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.

Hold back the third pass for when you have decided on some pattern and you need to implement it. If you are like me, you probably don'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. With these reading styles you will be able to make the most of patterns.


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