3 ms·
I hate these deliberately obtuse articles about design patterns every time they bubble up each year. Patterns are about naming and communicating design choices.
by thom 9y ago
I hate these deliberately obtuse articles about design patterns every time they bubble up each year. Patterns are about naming and communicating design choices. Just shouting 'function' over and over again isn't really relevant.
Like, it's true you can implement a Strategy with a function. And yet the majority of libraries on my current Clojure project don't let you supply a function as a strategy even when it'd make sense. Because none of the authors have made that design decision. Also your commands don't support undo. That'd take _two_ functions. And you know how you might communicate what those _two_ functions taken together do? You could use patterns! So somehow, just having a language feature doesn't MAGICALLY lead one to make one design decision over another. It didn't in the 90s, it didn't in the 00s, and it doesn't now.
Looking forward to 2025's version of this snarky article in Julia or whatever though.
- blain_the_train 9y agoYour right, having a to tool doesn't mean you use it correctly. However, the harder it is to apply a tool the less likely you are to do so. I think the authors point isn't to demonstrate that the design is bad, but rather how it's done in clojure.
- thom 9y agoC++ or Java or whatever not matching someone's aesthetics doesn't change the fact that providing an interface that accepts a Strategy or works with Commands is a design choice, not a language feature. It doesn't matter how it's implemented. The snippets of code in the GoF book aren't the point of design patterns, they're in no way canonical, and people pretending for _decades_ that they are really grinds my gears. But not as much as Clojure having no good implementation of the age old 'Readable Stacktrace' design pattern. :)
- sooheon 9y ago> It doesn't matter how it's implemented Well it does, a little bit. If you implement them by aligning rocks on a sunny beach, it might take a tad longer and more prone to bit rot. Java may as well be that for some people.