Earlier quoted context omitted.
Object-oriented order and elegance compared to an object-infested mess of special cases and complications. Remember that 25 years ago C++ wasn't a pleasant place and Design Patterns was an impressive step forward.
Oh, I do remember the grim story really well. I was there. I still have all the books. And the scars. Back then I was a young innocent programming soul trying to reconcile C++ and GoF and UML and all that. And Modern C++ Design. And const here const there const copy constructor by reference. Anyway. I like vanilla C. And Go at times.
Design Patterns Are Temporary, Language Features Are Forever
51–60 of 67 posts
Re: Design Patterns Are Temporary, Language Features Are Forever
#52I always tell people who obsess over design patterns as clean code and good coding practices to remember that design patterns often indicate a lack of language features. For example, are you using a Builder? Would you use the Builder pattern if the language had named variables in arguments? My favorite reference on the topic is Peter Norvig's "Design Patterns in Dynamic Languages" (1996!) https://www.norvig.com/desig…
Re: Design Patterns Are Temporary, Language Features Are Forever
#53Re: Design Patterns Are Temporary, Language Features Are Forever
#54Earlier quoted context omitted.
Someone else beat me to it. Will answer anyway. Had a very similar experience to yours with one important exception. The visitor pattern is relevant for traversing ASTs in single dispatch languages. Most notably, this includes Java and C++. The alternative concept is multiple dispatch and it is way more anti-fragile. This is where the next step in college literally was to learn the concept of cargo-culting. The conce…
What do you mean by "multiple dispatch"? What's an example of a multiple dispatch program?
https://medium.com/@AlexanderObregon/how-pythons-multiple-di...
Re: Design Patterns Are Temporary, Language Features Are Forever
#55Re: Design Patterns Are Temporary, Language Features Are Forever
#56Earlier quoted context omitted.
Oh, I do remember the grim story really well. I was there. I still have all the books. And the scars. Back then I was a young innocent programming soul trying to reconcile C++ and GoF and UML and all that. And Modern C++ Design. And const here const there const copy constructor by reference. Anyway. I like vanilla C. And Go at times.
I spent about 12 years doing C++ at the very peak of its OOP hype and did the same... then finally left, certain that I would hate doing "real" work in any other language, and a funny thing happened... I realized I was suffering from severe Stockholm Syndrome. Node.js was just.... so gd easy to do anything in. Maybe too easy (a la leftpad), but build/deploy cycles were instantaneous, adding new libraries was easy- ag…
I remember arguing for years with my father (also a programmer) about him writing either vanilla C, or writing C++ in (what would become) the data-oriented style.
...and look at me now!
I collect things in arrays, with no objects, preferrably in pure C. No classes, no objects, just arrays and transforming functions everywhere.
Re: Design Patterns Are Temporary, Language Features Are Forever
#57This reminds me of when I was still in university. During our compilers course we used the "Modern Compiler Implementation in Java" book. Because I was really into FP at the time, I instead used the "Modern Compiler Implementation in ML" version of this book (which was the original, the Java and C versions were made to make it more accessible). We noticed during the course that my version was missing a whole chapter…
$className = "MyClass";
$classInstance = new $$className();Re: Design Patterns Are Temporary, Language Features Are Forever
#58This reminds me of when I was still in university. During our compilers course we used the "Modern Compiler Implementation in Java" book. Because I was really into FP at the time, I instead used the "Modern Compiler Implementation in ML" version of this book (which was the original, the Java and C versions were made to make it more accessible). We noticed during the course that my version was missing a whole chapter…
> that software design patterns are sometimes failures of the language when they have no concise way of expressing these kinds of concepts. This is _the_ most common comment you hear in any language design discussion, and it's so boring. Java doesn't have visitors because it's the best the language could come up with. It has visitors because of a particular dogmatic adherence to OOP principles. A fundamentalist readi…
I think this is a bit of an exaggeration, unless you're talking about very modern versions of Java (sealed interfaces and better pattern matching). Java has no good way to attach different data types to each enum variant (a la ADTs) except inheritance, and until recently switching over class types was a PITA.
Re: Design Patterns Are Temporary, Language Features Are Forever
#59This reminds me of when I was still in university. During our compilers course we used the "Modern Compiler Implementation in Java" book. Because I was really into FP at the time, I instead used the "Modern Compiler Implementation in ML" version of this book (which was the original, the Java and C versions were made to make it more accessible). We noticed during the course that my version was missing a whole chapter…
«Design patterns are bug reports against your programming language» (Peter Norvig) This is pithy, but only applies to some rote design patterns which you have to code every time because the language lacks a good way to factor them out. Wider-scale patterns often express key approaches enabled by the language, and they can't go onto a one-size-fits-all library or language feature, because you tailor their implementati…
Also, I'm not sure how some of these patterns could be realized as language features. Like, particularly the common UI patterns.
Re: Design Patterns Are Temporary, Language Features Are Forever
#60I have a bug/hate relationship with the visitor pattern: how do I implement it without causing a stack overflow in languages without tail recursion optimization? It always ends up in a loop with a lot of ifs inside.