News for hackers. Stuff that matters.
Re:The most mentioned books on Stack Overflow by ajmurmann on Wednesday February 08, 2017 @11:08AM (#13599297)
I think it's not fair to the authors. As you say they are clear about the patterns being examples. However, there seems to be something about the book or maybe patterns in general that make it seemingly impossible for many developers to not look for use cases of these patterns and start using them in cases that don't quite match. I lead a book club at a post employer where we read the GoF. I constantly emphasized that these are examples of how we might reason about OOP and that they are inappropriate more often than not even though you think they are a fit. Yet, of course some people started suggesting them frequently. I think the problem might be that the first part is a support quick read and then you spend a huge amount of time reading the catalog. Once you understand them, you see how nice the patterns are on their own and you want to use them. They are pretty and you've spent time learning them. So it's only natural. It's a beautiful mental trap.
Re:The most mentioned books on Stack Overflow by JimDabell on Wednesday February 08, 2017 @11:41AM (#13599624)
> However, there seems to be something about the book or maybe patterns in general that make it seemingly impossible for many developers to not look for use cases of these patterns and start using them in cases that don't quite match.

Perhaps. But consider the background. People write code that isn't very well designed all the time. Maybe you just see these patterns misused so often because you can identify and name them. This is entirely the point behind the book – so we can identify these common patterns and talk about them at a higher level.

You've probably seen bad code where you can't describe what's wrong with it succinctly a lot too. But you don't have the option there of saying "oh, they've used a factory there when they shouldn't have" because the bad code doesn't follow a pattern that you know / have named. So all of those cases just get filed away in the fuzzy "bad code" category instead of being an example of a pattern being misapplied.

By definition, almost, something being a pattern is going to be something you see misapplied simply because that's part of the purpose of design patterns – so you can comprehend these problems better.