Hacker News new | ask | show | jobs
by thedracle 1703 days ago
Python is four years older than Java, and both have been extended a great deal since their inception.

The original Design Patterns book was written with Smalltalk in mind, which was dynamically duck typed, and had functional features (code blocks), among other things that didn't come to Java or Python for almost a decade.

Perhaps some language features are comparable to and negate the need for some design patterns, like Visitor with multiple dispatch which is provided by Julia --- but most creational, and behavioral design patterns are more just techniques that are independent of most languages and language features.

I definitely dislike the flavor of these articles that paint design patterns as a toolkit to piece together to build programs, rather than recognized components of a sound architecture which can help you build and design software that can be more easily reasoned about and extended.

It does lend to people making rube-goldbergesque monstrosities without really thinking about the why behind the way they are doing things.

I do think there are patterns I have recognized while programming in Rust, Ocaml, and a number of other languages, which never have had a description lent to them; and it's nice to see design patterns being talked about again, beyond the hype of the 1990's.

1 comments

> … written with Smalltalk in mind…

"Since we must eventually implement our designs, a design pattern also provides sample C++ and (sometimes) Smalltalk code to illustrate an implementation."

Chapter 1. Introduction. "Design Patterns: Elements of Reusable Object-Oriented Software"

https://www.google.com/books/edition/_/6oHuKQe3TjQC

What's your point exactly? Did they have smalltalk in mind or not?
I wouldn't say so:

Two of the authors - Erich Gamma, John Vlissides - clearly had a background in C++.

Ralph Johnson - clearly had a background in Smalltalk.

Richard Helm - not enough information.

They said -- "We chose Smalltalk and C++ for pragmatic reasons: Our day-to-day experience has been in these languages and they are increasingly popular."

They said -- "Our patterns assume Smalltalk/C++-level language features…"

So when the original Design Patterns book was written, which features did C++ have "that didn't come to Java or Python for almost a decade" ?

Okay... They knew of Smalltalk, and many of the design patterns were around smalltalk features.

And as you pointed out one of the authors had a strong background in smalltalk, and they chose Smalltalk for examples presented in the book.

In other words, they had smalltalk in mind.

It wasn't like smalltalk was some alien language none of the authors had ever heard of, or wasn't the subject of the book in any way.

In their words, they had "Smalltalk and C++" in mind.