Tom said:
It's true that the traditional design patterns are larger-scale than
things like the select technique. Does this mean that small things can't
be design patterns? Or do we have a different name for smaller things?
Would you consider something like "have a single exit point for each
method" and "make all parameters final" patterns (whatever you might
think of their merits)?
When it comes to things which are language-specific, as i think the
select technique is, i've heard the term "idiom", and i rather like
that. Our recent discussions about exception handling techniques fall
into that category too.
tom
I guess to me it's the level of abstraction which does the trick. That
is, when we use some technique over and over again, we start to think
"hey, there's some common use going on here" and then we see an emerging
pattern. The GoF book focused on what in a very loose sense may be
called "collaborating" classes precisely because the level of
abstraction required meant that several classes were needed.
I would probably consider good practice such as "have a single exit
point for each method" a pattern, but in some other sense. I'm afraid
words faild me, but it's been considered good practice since the
beginning of structured programming, I guess (isn't that late sixties or
something, as I recall?). I wouldn't consider these practices patterns
in the sense of the word being exploited by "recent" books, because
these tend to focus on, well, the bigger picture. So, words fail me...
I don't know if the select technique is language-specific. I think the
original article was "Communicating Processes" with a language which I
honestly think was created solely to exploit the idea. I'm unsure, but
just off the top of my head, I believe this technique is found in a
number of languages, since it's so useful.
I think the term "idiom" is a good one, too, but there's some difference
here. I don't know what, but I think "idiom" is a broader sense to me -
and something which needs to be in widespread use. Just putting in two
cents.
Regards,
Jan Paulsen