4 ms·
I've had the same thought. I've never seen it confirmed by anyone, but to me, a lot of the original design patterns were stopgap conventions to patch shortcomin
by endymi0n 5y ago
I've had the same thought. I've never seen it confirmed by anyone, but to me, a lot of the original design patterns were stopgap conventions to patch shortcomings in the languages of their time (mainly early Java).
Just look at the Visitor pattern. It's a convention to expose an "accept" method that can be "visited". That's pretty much what you'd do far easier and more naturally with functional programming these days, even in Java. Going in depth, you can see the same possibilities everywhere. "Proxy" should probably be a registerable middleware, etc. etc.
Then again, I might be biased. Design Patterns already let my BS detector go bonkers 15 years ago when I encountered them first, as as academization and complication of software by self-indulgent "enterprise programmers" that I couldn't ever see any advantages to (and these days, I feel enjoyably vindicated).
Funnily enough, in this way they were quite anti-academic, as they came from original research of the "Gang of Four" and I've never seen scientific proof they actually made anything better. I stand to be corrected though.
- fiddlerwoaroof 5y agoI sort of think of design patterns as common code patterns that can’t be abstracted over. In Haskell, I think mtl-style type classes probably count. Maybe also the sort thing the lens library does where it says “any function that looks like this and obeys these laws can be used as a lens”. In Java (especially older versions), this set of things includes a lot of things that are trivial if you have lambda expressions.
- tome 5y ago(By the way mtl-style type classes can be abstracted over, for example see my article: http://h2.jaguarpaw.co.uk/posts/mtl-style-for-free/ http://h2.jaguarpaw.co.uk/posts/mtl-style-for-free/)
- jcelerier 5y ago> That's pretty much what you'd do far easier and more naturally with functional programming these days, even in Java. but it's still a pattern ? patterns aren't classes. A specific way of sequencing function calls and operators is still a pattern.