4 ms·
I don't understand how design patterns can't exist in any language. I'd even argue its the existence of design patterns that make programs readable at all. I
by kenjackson 15y ago
I don't understand how design patterns can't exist in any language. I'd even argue its the existence of design patterns that make programs readable at all. I can look at code and say, "ahh... case analysis."
- johnzabroski 15y agoI can look at code and say, "ah, Alan Perlis, you were right when I read your advice when I was 11 years old, but did not understand your wisdom [1]": 10. Get into a rut early: Do the same process the same way. Accumulate idioms. Standardize. The only difference(!) between Shakespeare and you was the size of his idiom list - not the size of his vocabulary. [1] http://www.cs.yale.edu/quotes.html http://www.cs.yale.edu/quotes.html
- eropple 15y agoThat would be because they (obviously) do exist. This comes off as people strangely perturbed about the popularity of Something They Don't Like to me. (Paul Graham's own comments on the matter included.)
- loup-vaillant 15y ago> That would be because they (obviously) do exist. Spot on. Now what? Well, you could for instance ensure that the most common patterns are as readable as possible. Most of the time, that means adding special support for them, or let the user write such special support. Case analysis, for instance, is a pattern. Now you can implement it with nested `if`, or you can use a `switch` statement (if your language has either `switch` or macros). Personally, I prefer the `switch` statement, which at a glance makes clear what pattern is used. GoF patterns are useful. The shame is C++ and Java's inability to properly implement them. Really, if you often use mixins, maybe you need closures. If you often loop over data structures, maybe you need `map` and `filter` (as closures or special syntax). And so on. GoF patterns don't suck. They just highlighted how much C++ and Java sucked, by showing how much copy-paste you have to perform. In an ideal world, patterns would only be instantiated once: in the compiler or in a library. On a related note, here is why I think C++ and Java suck, badly: http://www.loup-vaillant.fr/articles/classes-suck http://www.loup-vaillant.fr/articles/classes-suck
- eropple 15y agoYou get map/filter/reduce via boost pretty easily, though.