3 ms·
FWIW, the gang-of-four patterns book was a good idea. And still would've been, even if people were using crazy-powerful dynamic languages like Lisps instead of
by neilv 7y ago
FWIW, the gang-of-four patterns book was a good idea. And still would've been, even if people were using crazy-powerful dynamic languages like Lisps instead of C++ (though the examples would've been very different, and then some would seem odd to include).
One way to look at the patterns book is that it communicated a bunch of software architectural patterns that a developer might learn over many years of reading code others had written, and writing their own code. Suddenly, a new programmer could recognize and use those patterns immediately.
Of course, at the time, it wasn't lost on the people who knew a bunch of OO analysis and design methodologies and programming languages, that there was heavy C++ bias to the exact patterns included. And we started to make comments like Norvig did here. But design patterns and the book were a good idea.
Also, I was just a kid developer at the time, but, when the book first came out, I recall one of the principal engineers was looking into how patterns might be used for documenting large, well-engineered OO systems.
- erokar 7y agoThe point Norvig makes is that these patterns have emerged to mitigate shortcomings/lack of expressiveness in languages like e.g. C++ and Java. Expressive, dynamic languages lack these limitations and thus there simply is no need for most of these patterns.
- neilv 7y agoBut some of them (we won't speak of Singleton) are patterns that are helpful in conceiving of and understanding architectures or how the implementation language is used, even if an instance of the pattern looks like a very simple expression in the implementation language?
- senderista 7y agoThe GoF book is full of Smalltalk examples (in addition to C++). People who claim design patterns are irrelevant to dynamic languages have clearly never read the book. It would be more accurate to say that the patterns demonstrate the limitations of OO languages than static languages.
- kazinator 7y agoI've mostly been exposed to the claim that design patterns are irrelevant in Common Lisp, not all dynamic languages. Smalltalk is single inheritance, single dispatch, so it's going to need some of those patterns. I suspect that Visitor will have some considerable boiler-plate in it, compared to how it disappears in CLOS. (The boiler plate, that is, not the pattern overall; the concept of visitation is still there, just not in so many lines of code.) Anyway, are those examples really the best Smalltalk solutions, or are they just there to show how the patterns look in Smalltalk? For instance, the ability of an object to change type (or appear to do that somehow) will blow off those patterns that deal with simulating an object changing type as it changes state, like the State pattern. Smalltalk has something called become which isn't exactly the same thing as Lisp's change-class, but it sounds like a reasonable facsimile thereof which could obviate the State pattern. Like if we have a widget that changes from an idle to a running state, we could just have a variable iw that is of type idle_widget, and then say "iw: become rw", where rw is a running_widget constructed from the properties in iw. Does the book, by chance, have State done up in Smalltalk without mentioning the become operator?
- deleted 7y ago[deleted]