|
|
|
|
|
by evercast
1703 days ago
|
|
When looking at the GoF design patterns, I believe one should also note that they were created not only to solve a bunch of design problems, but also to deal with the limitations of the programming languages back in the day. For example, if you learn about them in the Java context, they make perfect sense as they are well aligned with the language features required to implement them. Try however putting them in Python context and they often result in unnecessary complexity. You can actually see this in the article. The Python examples are awful (not very idiomatic). This is just Java written in Python, even with non-Pythonic camelCase naming. |
|
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.