Re: Singletons
On 12/18/2012 1:28 AM, fmatthew5876 wrote:
Are design patterns really useful, even to the journeyman?
I think they are useful in that they might introduce you to new ways of
thinking about and solving certain classes of problems.
On this aspect I agree with Francis and especially Kevlin. I
independently reached the same conclusion, that reading GOF (and similar
taxonoms) help you if you already know the pattern beforehand, and
benefit from its good description and attached finer details.
While taking an unfamiliar description and searching its manifestations,
let alone jump to implement it is IMO good way to trouble.
I've found a couple
times when someone starts talking about some fancy new design pattern by name
that once I learned what it was, I'd already used a variant of it previously
without knowing.
Yep, the pattern is observed from common usage.
The danger of course is learning a design pattern, accepting it as gospel
truth, and then trying to stuff all of your square code into the round pattern.
I doubt it would work well even for the square pattern with the
approach. When I want a house I first think of its purpose, use, then
select some fitting layout, then materials. I don't start as "I have
this heap of PTH38 bricks, how could I fit them into something?"
Perhaps design pattern books should explain this caveat in chapter 1.
Perhaps the do, if not in Ch1 but the intro. But who reads that part? ;-)
One could also argue its useful to have a common vocabulary.If I'm trying to
describe a design to you and I tell you I'm using pattern X, you already have a
concept of what that means before we go into the details.
It is very useful. If used for its purpose: communication. Not something
else, like showing off, replacement for understanding, etc.
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]