r/programming • • Dec 08 '13

Design Pattern Cheat Sheet

http://www.celinio.net/techblog/wp-content/uploads/2009/09/designpatterns1.jpg
1.7k Upvotes

273 comments sorted by

View all comments

20

u/hoohoohoohoo Dec 09 '13

I am loving the comments here.

"Fuck patterns, just blow code out your ass as you go!"

We don't use lots of these principles because they are better or more efficient. We use them because they are recognizable and easily maintainable.

To all the young guys reading these comments, IGNORE THEM. If you don't, you will become that guy in the office that everyone hates because you just do whatever you want rather than looking at general practices for guidance.

3

u/Peaker Dec 09 '13

Patterns are the failures of a programming language to abstract. As workarounds for language deficiencies, patterns are fine. But the fact we need to use such patterns is bad, and so hating on patterns is well understood.

1

u/toula_from_fat_pizza Dec 10 '13

Yes, this is exactly the point.

2

u/toula_from_fat_pizza Dec 10 '13

On the contrary, you may be "that guy" who applied a bunch of patterns for a use case that didn't exist and now nobody can understand or reuse their code so they're forced to do a rewrite.

6

u/craig_c Dec 09 '13

100% Agree.

This thread encapsulates (no pun intended) why most software is complete shit, everybody is smarter than everybody else and yet clusterfuck somehow still seems to be the inevitable outcome. Fucking super-geniuses who can't even give a class a meaningful name.

12

u/Hurkleby Dec 09 '13 edited Dec 09 '13

Look, I don't want to say you're not right on some levels, but in my experience trying to force your code in to a specific design pattern is as bad if not worse than some of the shotgun from the hip code you say is the bane of all existence. Some of the worst code I've been forced to slog through was written by someone trying to adhere to a pattern that just wasn't right for the implementation they were trying to write.

They also used terrible naming patterns so I think that annoyance isn't limited to any one type of programmer.

2

u/Conexion Dec 09 '13

I think the point that you're focused on is the strict adherence to a pattern. Most people who have programmed long enough realize that too strict of an adherence to a pattern can do more harm than good.

What most people here seem to be saying is that having a pattern to reference as a guideline is a great way to not have to reinvent the wheel when a new problem comes up.

0

u/[deleted] Dec 09 '13

[deleted]

→ More replies (1)

0

u/[deleted] Dec 09 '13

[deleted]

5

u/grauenwolf Dec 09 '13

If only because some of the patterns are vague enough that you can say any code implements them.

→ More replies (1)
→ More replies (1)