Design patterns have (mostly) flopped
supercoders.com.au
supercoders.com.au
Design patterns have flopped because many if not most of them have proven not to be the universal computer science gems they were touted as.
Rather, they've proven to be:
* Stock workarounds for the overly restrictive type system of a particular language X
* Patterns which in a more powerful language would be a language feature (or trivially abstracted into a small chunk of library code using the language's existing facilities for abstraction) -- but in language X, require so much boilerplate for each invocation, that the boilerplate merits a special name.
(Where for X, substitute mostly Java :)
I think the relative popularity of design patterns in the Java community has less to do with the verbosity of the language than with historical accident (design patterns became popular at around the same time as Java).
> Design patterns are a universal language that few people speak, a sort of Esperanto for programmers.
Exactly. And I fully expect many of the hackers here to chime in with 'oh, that article is so wrong'. But, the thing is, HN geeks, you are that rare breed that knows and applies the patterns. I've met you, and I've worked with you. And for every one of you I've met in my career, I've met 200 who couldn't give a damn what a DTD is, let alone a pattern.
Design patterns are actually an excellent concept, but they won't really help programming for the masses. And, the more we depend on computing in our lives, the more we need programming as a technical discipline to be able to accomodate the masses. For every structural engineer out there in the real world there are probably a thousand architects. And for every architect, ten thousand carpenters. I know an expert carpenter and I'm pretty sure he couldn't calculate the tensile strength of a basswood 2x4, but he can sure build me a deck!
My other problem with this article is that the author starts off sounds like he almost understands a bit about programming, but then he veers off unforgivably about the divine superiority of design patterns. "They are worked out for you and bestowed from on high by geniuses so much smarter than you that they solved all problems at once better than you will ever solve your specific problem, and therefore your code will automatically be better if you use them, and suck if you don't!" That's a ridiculous overstatement at best. Knowing design patterns is better than not knowing them, but only if you have the chops to apply them properly. If you don't then you may just be adding complexity without solving anything. Furthermore, design patterns are actually just an emergent property of working systems; just because you don't know what they're called doesn't mean you're not using them. To work with code, such as to make bug fixes, or to extend it you need to go to a much finer level of detail, and to make a large scale system you need to think about overall data flows that are far higher level than the design patterns used in individual components.
Design patterns are to programming as literary devices (allegory, simile, onomatopoeia) are to writing. If someone knows them you can tell they have studied literature, but it doesn't mean they can write worth a damn.
If someone knows what design patterns are then that's one piece of information to find out about them during interview and add to the overall picture of them.
I do agree that there is alot more to finding out if someone is a good programmer that one aspect such as design patterns.
Actually the okay but not so good programmers are more likely to be hung up on design patterns. They have learned few of them, and try to apply wherever they can, even when they really shouldn't. Aslo people that tend to do over-engineer a lot tend to overuse design patterns. Also you will see them in interviewees asking a lot more about design patterns themselves than actually coding/problem solving ability. It is is just a higher end version of asking "programming trivia".
To the risk of being downvoted, I repeat again: overuse of design patterns is a hallmark of mediocre programmers, or programmer that are not very experienced yet (they may become really good one day, but not there yet).
In fact, though, what has proven my comment wrong is that the HN community has not chimed in as I predicted. This is a(nother) really informative and thoughtful conversation... I love it here! :D
A skilled software engineer will recognise important aspects in a given situation and design a suitable solution based on similar situations (patters) without necessarily having a name for it.
Every attempt to formalise good engineering practices has met with a similar fate. Be it structured programming, design patters, agile development, or something else, they all fail when the chosen process is followed to the letter at any cost, no matter how absurd the consequences.
"In the recruiting work I have done I've asked thousands of programmers to explain the concept behind design patterns"
I'd have to find some data to back up what I suspect, which is that the bottom X% of programmers (or at least would-be programmers) cycle through all those job interviews where this lack of knowledge becomes apparent (unless you're recruiting for a really high-level position where the top programmers might be interested in applying, and even then many are already content where they are).
So, if you're any good, you're not as likely to be interviewed, and so the population is flawed.
That doesn't mean that design patterns have or have not flopped. At least, every one of my coworkers have been taught the patterns. Whether we apply them or not might merit a study, one with a methodology that doesn't mislead the observer and where a more valid conclusion might be reached (it could even be the same conclusion, that is, that they have flopped).
http://www.joelonsoftware.com/articles/FindingGreatDeveloper...
If you believe that good programmers are more likely to be offered a job than bad ones, it pretty much flows from that that bad programmers will be interviewing more. If that's so, then you are more likely to interview bad programmers. Statistically, on average, etc. Not in every case.
It's not true in general however that good and great programmers don't have to go through the normal channels to find jobs. I encounter many extremely talented programmers who weren't just snapped up by their network of colleagues.
just because you dont have a class called Factory in your code, doesn't mean you're not using one.
and finally, if your programmer doesnt know what design patterns are, do yourself a favor and tell them to learn at LEAST what they are. they'll find a use for them, guaranteed.
Mmmhh I think im going to spend more time on SICP and PAIP then on the Gof Book and more programmers should do that.
also, "inferior languages"? really? can you elaborate? I would also like to transcend beyond the petty squabbles of mere mortals and my .net/python existence.
I don't really have time to type out a long reply as to why C++/Java style design patterns don't occur in better languages, but I'd recommend putting some time in on lisp, ruby, or haskell. If you read idiomatic code in those languages, I think you'll understand my point.
They're a neat-seeming idea with very little practical value because the real world doesn't fit into a small set of neat patterns, no matter how cute you name them. Overall, they do more harm (usually of the "golden hammer" variety) than good.
Whether or not any specific world changing patterns have come out of the movement doesn't really matter to me. What matters is that the average blub programmer is just a little closer to understanding that classes are not just for modelling real world 'things'.
(I'm mostly an OOP programmer, assume something intelligent about functional programmers etc for me...)
http://sites.google.com/site/steveyegge2/singleton-considere...
http://www.informit.com/articles/printerfriendly.aspx?p=1404...
"When discussing which patterns to drop, we found that we still love them all. (Not really- I'm in favor of dropping Singleton. Its use is almost always a design smell.)"
This is not to say that specific patterns are not of merit in the right circumstances, of course. Just that the notion of design patterns as some kind of shrink-wrapped, off-the-shelf, one-size-fits-all solution is something I find mildly alarming.
Everything looks like a nail to a guy with a hammer.
If they'd mostly programmed in modern dynamic languages (Perl/Python/Ruby) I wouldn't expect them to know most of the individual patterns, since they're not terribly relevant for those languages.
And Javascript, another modern dynamic language, also has a lot of design patterns.
I find it hard to believe that not all languages have their own design patterns. Just different kinds for solving the types of problems they tend to run into more often.