r/programming • • Feb 23 '12

Don't Distract New Programmers with OOP

http://prog21.dadgum.com/93.html
207 Upvotes

288 comments sorted by

View all comments

Show parent comments

7

u/[deleted] Feb 23 '12

The patterns in the GoF book were selected to fill a page count requirement, nothing more. Real design patterns are language specific.

2

u/hyperforce Feb 24 '12

Do you have any sources to back up that statement?

3

u/[deleted] Feb 24 '12

The complete and utter lack of meaningful examples was my first clue. Just look at the flyweight pattern for an example of utterly inappropriate application of a pattern.

Or the visitor pattern, which makes the whole class tree non-extensible without making breaking changes to the abstract interfaces. I can't think of any language where that's the right pattern to solve the visitor problem.

Even for something simple like the singleton pattern they got it wrong. At the very least they should have addressed the trade offs between a true singleton object, a class with a default instance, and a purely static class/module. But they couldn't because then they would be looking at a real language instead of talking in vague terms.