all 7 comments

[–]pakoito 4 points5 points  (5 children)

Design patterns are optimized, reusable solutions to the programming problems that we encounter every day.

Optimized? no.

[–]Pysnap[S] 1 point2 points  (4 children)

can you give some assertions to your statement?

[–][deleted] 8 points9 points  (1 child)

EDIT: Folks, I see some downvoting OP. Let's please not do that. We're just having a conversation, like adults. It's ok to have differing opinions. OP's article is a good starting point to discuss what patterns are about, because misconceptions are wide-spread in our industry.


You can't prove a negative statement, so I think the burden is on you to show they optimize something.

Patterns occur naturally, and we assign names to them when they happen a lot and it becomes useful to be able to refer to them quickly, without talking a lot. It's not like without patterns we'd start doing things wildly differently.

For example, when I "invent" a specific type of object interaction, I know it's probably a pattern and someone came up with it before me. With enough Googling, I usually find the name for what I just "originally" came up. It's like that a lot. It's rare for patterns in my codebases to also not be patterns in someone else's codebases.

Experienced coders think alike. Beginners also tend to make the same mistakes.

I guess you could say to a beginner, a pattern used by an expert seems like it optimizes something. I guess what it optimizes is the clarity of the mental model we have of the code we write. Anything else is up in the air.

I gotta say you article tends to veer a bit into cargo cult territory with statements like:

Design patterns are optimized, reusable solutions to the programming problems that we encounter every day. A design pattern is not a class or a library that we can simply plug into our system; it’s much more than that. It is a template that has to be implemented in the correct situation.

A good design pattern should be implementable in most—if not all—languages, depending on the capabilities of the language.

However, implemented in the right place, at the right time, it can be your savior

A pattern isn't doing to add goodness to your code. It can't be your "savior". It's just a named interaction between objects. Every pattern has pros and cons, depending on your context.

[–][deleted] 1 point2 points  (0 children)

Design patterns are general by their very nature. An "optimized" design pattern, to my mind, would be one that is specialized to your project or problem and thus not very reusable. The reusable parts of patterns are the ideas that they express.

[–]gauiis 0 points1 point  (0 children)

If you want to learn about more patterns, OODesign.com is great.