10 ms·
“Design Patterns” Aren't (2002)
- quantified 6y agoFirst, please note that this is from 2002. Wish you could edit the title. The last slide in the series notes that the talk gets heavily flamed on. It gets flamed on for good reason, IMHO. From its intro: > Description The "design patterns" movement in software claims to have been inspired by the works of architect Christopher Alexander. But an examination of Alexander's books reveals that he was actually talking about something much more interesting. The presentation has two parts: a takedown of the Iterator (which kinda misses the point of iterator, it’s not purely a way to implement for-loops), and then a description of how Alexander had different goals than the GoF in their book. Ok... the book isn’t Alexander. Though the patterns community was on the path to trying to achieve similar goals, just this happened to be a handbook of patterns that were more recently discovered. Software architecture is not as well-codified a field as physical architecture, needs a century or two to catch up. The real complaint is that the book is not a “Pattern Language”, or the same as the famous Chris Alexander book. That’s not in the title of this talk. It’s also not really what the speaker spends much time on. Saying the C++ macro system blows goat dick doesn’t advance arguments about the difference between a handbook of patterns and anything else. Inspired by is absolutely true, inspiration has many effects and forms. However, GoF is also about discovering and communicating the patterns you discover, and contains useful examples. GHJV spend energy describing how the patterns were identified, clarified and named, and they use this language in presenting the examples. Meanwhile the author of these slides seems to thing it’s the copy side of a copy-paste command, which it definitely is not. There is no one true Iterator, nor Factory, Visitor, Facade, or any other pattern listed. So he misses the point by quite a margin, IMHO.
- deleted 6y ago[deleted]
- vikingcaffiene 6y agoI don't know why you are getting down voted. For what its worth I appreciate the analysis. I kind of feel like this post shouldn't exist without the author taking the time to explain his POV better than a few bullet points on a slide. The postscript kind of goes there but its not enough IMO. What we are left with here reduces whatever his point is to a few reductive statements that probably over simplify his arguments and leave the rest of us either nodding emphatically or shaking our heads in disgust because its just generalized enough to confirm any pre-existing bias we already have. In other words this wont change any minds. I guess the one good thing to come out of reading this is that I'll pick up that "Pattern Language" book and give it a read. Perhaps this post will gain some value in retrospect with that context.
- mjd 6y ago> I kind of feel like this post shouldn't exist without the author taking the time to explain his POV better than a few bullet points on a slide. I agree. It was a five-minute throwaway talk. Here's the same guy writing a better article on a related subject: [Design Patterns of 1972](https://blog.plover.com/prog/design-patterns.html https://blog.plover.com/prog/design-patterns.html)
- nocman 6y agoHi Mark! I love how you say "Here's the same guy..." like it was someone other than yourself. I was going to point out that the beginning of the article says that this was a "five minute long talk" given at YAPC, and did not represent your complete thoughts on the matter. But you saved me the trouble. :-D (edited for unintentional formatting)
- quantified 6y agoI get surprising downvotes a lot. Well, thank you for noticing!
- alisonkisk 6y agoIt's sad that we're bringing up a 20 year old throwaway presentation for ridicule. This article shouldn't have been posted.
- quantified 6y agoI agree. I think it was brought up for thought and discussion, and the first comment was strongly critical. If there are other thoughts on it, hope they get shared too.
- q845712 6y agoI think there's a lot of utility in trying to achieve some conceptual consistency across a large codebase worked on by many people. Most organizations of even 12+ developers wind up with an internal informal "pattern language" that you learn while onboarding, and it can be wildly helpful if that's explicitly acknowledged as an area of knowledge to help new teammates acquire. To me a lot of the tension comes from the "endless september" nature of software, that over the last 20 years we just keep absorbing more and more new-ish folks who come in with vastly varying levels of formal and informal education. I'm tempted to describe one mindset as "catalogers" in contrast to other mindsets that might be called "explorers", "consensus builders", "hackers", "do-ers", etc. (not a complete list nor entirely disjoint categories -- i'm a lousy cataloger!) I think part of this endless Design Patterns discussion is that some, myself included, would like to push back when "design patterns" starts to become "a standard and nearly exhaustive catalog that the whole field uses with uniform meanings."
- Smaug123 6y agoIn case you hadn't heard of Simon Wardley's "pioneers, town planners, settlers" model, it seems relevant to your third paragraph (https://blog.gardeviance.org/2015/03/on-pioneers-settlers-town-planners-and.html https://blog.gardeviance.org/2015/03/on-pioneers-settlers-to...).
- q845712 6y agoThat's interesting - thanks! I think "catalogers" as I'm thinking of them are by nature not quite pioneers, since the fundamental move of cataloging is to describe and categorize what already exists, but might often be settlers, in the sense that a good career move for a cataloger is to be the first to apply a new process to gain insight into new distinctions or categories. In that sense I would see GoF themselves acting as "settlers" in their Design Patterns book, which I tend to view as a catalog project. However books like "Refactoring", and "Working effectively With Legacy Code" also turn into partial cataloging projects, but those might overlap more with "town planner" in that they're really leveraging some mature technologies and looking for system-level economic savings of readability/changeability/maintainability. So I guess I'd continue to argue that it's a "mindset" as much as "a type of person"; "Working Effectively With Legacy Code" isn't _only_ a catalog, but there's parts of it that come from a catalog mindset. Regardless, I hadn't seen the above mapping you linked and I appreciate it!
- meitros 6y agoRichard Gabriel has a really interesting and more nuanced book about this that I read early in my career https://www.dreamsongs.com/Files/PatternsOfSoftware.pdf https://www.dreamsongs.com/Files/PatternsOfSoftware.pdf
- barefeg 6y agoI didn’t focus on the iterators at all and still didn’t get the point. What I got so far; an architect wrote a book with some definitions that allows people discuss a solution. Then the author says we should take that seriously. Which is fine, but how exactly? The author spends a lot of time on explaining why (for his POV) software design patterns are wrong, but no example of how to use what the book says in software. What am I missing?
- dwenzek 6y ago> How can you distribute responsibility for design through all levels of a large hierarchy, while still maintaining consistency and harmony of overall design? This how the author summaries the intent of Christopher Alexander's work. I have not read "A Pattern Language" so it's difficult to say if this is accurate or not. However this is such an important issue in software engineering that I would welcome any ideas to reduce the problem. I agree when the author that the GoF addressed a lower level problem. However, I'm also disappointed by these slides that provide not hints for a better high-level approach. The GoF patterns form a language for developers speaking to developpers. We also need a language across roles.
- kgeist 6y agoDesign patterns appear in languages without enough syntax sugar. But having too much syntax sugar can be a problem, too. At least, design patterns translate between languages/systems, it's a common language. Syntax sugar isn't.
- captainmuon 6y agoThe best explanation I heard of design patterns is, that they are not a template to slavishly follow when producing code, but a common language to talk about code. So you should be able to go and identify, look, this is an iterator, this is a command pattern, this is a monad, and you have a clear and concise way to reason about your code and talk to other people. The second best explanation is that patterns are often a sign of shortcomings in the language. OP gives the example of iterators. Another example is the visitor pattern. Or async/yield as a replacement for explicit state machines. A thing I'd really like to see in a language would be language level support for the command pattern (being able to capture arbitrary blocks of code, lift the execution to an object, and undo/redo it). Or to be able to include the state of an object in the type system - not like Rust does it with typestates, but to be able to say `Child` is a `Person` where `age < 18`, and if the compiler can't prove that the condition always holds, then it will force you to write the precondition checks or check it at runtime.
- BoiledCabbage 6y agoThat last thing you're looking for I believe is called dependent types.
- Smaug123 6y agoDependent types are one way to achieve that effect, but I think what you're actually referring to is "refinement types".
- centimeter 6y agoSee LiquidHaskell for probably the most mature SMT-based refinement types implementation.
- hosh 6y agoThat’s great, but misses the point. Christopher Alexander’s big ideas involve the people who lives, works, and plays within the architecture. The pattern language was designed for them, so they can participate in the design process of their own living spaces. The equivalent would be a pattern language that app users themselves can use for their apps. Instead of having the app developers drive design with A/B testing to gain user traction (with a societal risk of dark patterns), the users themselves put things together that would work with how they are doing things. The implementation of the code would work from there. Something the end-users can change the code themselves. Smalltalk was designed to allow that level of user participation ... but the legacy we ended up with is OOP and gang of four. If anything, something like TCL/TK is closer to that vision than what we currently have. (What we currently have: mass lockin of consumers and end-users by a different Gang of Four — Facebook, Amazon, Apple, Google). Alexander’s keynote to the ‘96 OOPSLA conference goes into detail about his ideas and how it can be applicable to software engineering. He was imploring software engineers not to make the same mistake that architects did with his pattern language ideas ... but we still made the same mistake anyways.
- neonological 6y ago>What is a Pattern? >An 'element of reusable software' >A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context. Interesting to note that the person defines a pattern as something exclusive to using Objects and classes or in other words OOP. So something like lenses or functors or programming techniques defined outside of OOP are not patterns. When I talk to people they often define design patterns as a common language for various methods that are common to programming and not exclusive to OOP. Doesn't english and vocabulary fill this space? You don't find carpentry workers referring to domain specific vocabulary as design patterns. Why don't FP practitioners or mathematicians call their techniques "patterns"? This may piss some people off and get me a load of downvotes, but honestly IMO I find design patterns to be just snobbery. Instead of saying someone is iterating through a list they say that someone is using the iterator pattern. It's really just prefixing the word "pattern" onto some vocabulary. I used the number pattern on the variable pattern and the addition pattern to get the sum of two numbers. I would've just called the book "Programming Tricks for OOP" rather then "Design Patterns."
- alisonkisk 6y agoFP programmers call their patterns Typeclass Laws. Mathematicians aren't building/designing things all day long so they don't need this word. "A pattern language is an organized and coherent set of patterns, each of which describes a problem and the core of a solution that can be used in many ways within a specific field of expertise. The term was coined by architect Christopher Alexander and popularized by his 1977 book A Pattern Language." (Wikipedia on Pattern Language).
- neonological 6y ago>Mathematicians aren't building/designing things all day long so they don't need this word. Not true, they build proofs. Within proofs there are many many common techniques, aka "patterns." Either way you seem to imply that "patterns" are for people who "build" things, which isn't emphasized in your definition below: >"A pattern language is an organized and coherent set of patterns, each of which describes a problem and the core of a solution that can be used in many ways within a specific field of expertise. The term was coined by architect Christopher Alexander and popularized by his 1977 book A Pattern Language." The problem with the above definition is that English vocabulary already communicates what a pattern does perfectly fine. What is the point coming up with an over complex name and postfixing all of these things with "pattern?" It's basically a redundant concept. In fact, my communication with you at this very moment is employing many many common patterns. Check the pattern in the previous sentence "many many." I call it the double emphasis pattern and I've used that pattern twice in this reply. I'll write more about it in my book on Design patterns for English communication.
- phromo 6y agoAlexander's works are wonderfully inspiring to read. I'm sure they can inspire many diverse interpretations useful for creating digital artifacts. To the curious, note that what the patterns are is not explained in 'A Pattern Language' but instead in the companion book 'Timeless way of Building'. It's quite a philosophical exposition. It talks about evoking 'The quality without a name', that every human has the capacity to feel, but not necessary to name or dissect. Here's a quote for the curious from 'Timeless way of Building' that I think captures somewhat what the post wishes more software designers thought about in relation to patterns: (page 236-237, speaking about the specialisation of professions in which people's pattern languages gets lost through disconnection) "... Of course, even now a town still gets its shape from pattern languages of a sort. The architects and planners and bankers have pattern languages which tell them to build gigantic steel and concrete buildings. The users have a few shattered patterns left in their vocabulary: a sheet of plastic to make a kitchen counter; huge plate glass windows for the living room; wall-to-wall carpet in the bathroom -- and they enthusiastically piece these patches together, whenever they have a free weekend. But these remnants of our former languages are dead and empty. They are based mainly on the by-products of industry. People use plate glass windows, formica counters, wall-to-wall carpet, because industry makes them available, not because these patterns contain anything essential about life, or how to live it. The time when a pattern language was a song, in which people could sing the whole of life, is gone. The pattern languages in society are dead. They are ashes and fragments in the people's hands"
- hota_mazi 6y agoThe author of this presentation claims that Perl's type system is better than C++ and that "the C++ macro system blows goat dick". Quality arguments and vocabulary.
- neonological 6y agoDon't let vocabulary or lack of evidence distract you from the main point. Lack of either doesn't invalidate the argument it just invalidates your bias. The burden remains on you to validate the argument and ignore your biases as obviously this author and the people who voted him up have their reasons for believing in what they believe.
- hota_mazi 6y agoI am making no claims, I have no burden. The author claims that the C++ type system blows goats dick, the burden is on them to actually prove their point besides using middle school recess vocabulary.
- deleted 6y ago[deleted]
- neonological 6y agoNah you're right. No burden on you. I'm just saying logically, if he makes that claim and you know he's not an idiot and a lot of people vote him up, then there must be a compelling reason for why he made the claim. The reasoning has the potential to change the way you think about his claim or it has the potential to be completely wrong. But the context of the situation makes it so that you cannot ignore the potential.
- ratww 6y ago> The author claims that the C++ type system blows goats dick No, he doesn't. He claims that the Macro system does. And he's right, C macros are full of well documented pitfalls [1][2], especially when compared to other languages. This is not really a controversial claim, btw. At this point this is common knowledge. "Blows goats dick" is letting it off easy, even. It only implies low quality, or difficult to use. C Macros however can be dangerous, unsecure and misleading. Also, this is an informal talk. Sure, you might take issue with his language, but I would expect someone taking issue with the claim to at least know about the general consensus on the topic. [1] https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html https://gcc.gnu.org/onlinedocs/cpp/Macro-Pitfalls.html [2] https://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C/Macros_and_Miscellaneous_Pitfalls.html https://www.brainbell.com/tutors/c/Advice_and_Warnings_for_C...
- khaledh 6y agoHis blog post on the topic goes into more detail and examples [1]. I tend to agree with him, especially his conclusion that "Patterns are signs of weakness in programming languages." [1] https://blog.plover.com/prog/design-patterns.html https://blog.plover.com/prog/design-patterns.html
- carapace 6y agoI think it's a reasonable critique of the concept of Pattern Language as adopted by IT. The interlocking nature of the patterns at various scales, the way that normal folk are expected to use the PL in situ to evoke and evolve design organically from an intrinsic understanding of their own needs and an informed intuition of the potentialities of the space, these are wholly omitted from GoF PL. Not, I think, because of any fault of them themselves, but because the very idea of applying Pattern Language thinking to computer system design was so novel at the time they proposed it. Certainly CA is a genius and I think we would all benefit from at least skimming the original "Pattern Language". (His latter work, "Nature of Order", is sublime.) It's worth reading CA's "A City Is Not a Tree" as well: https://en.wikipedia.org/wiki/A_City_is_Not_a_Tree https://en.wikipedia.org/wiki/A_City_is_Not_a_Tree https://www.patternlanguage.com/archive/cityisnotatree.html https://www.patternlanguage.com/archive/cityisnotatree.html I feel like Jef Raskin's work ("Humane Interface", the Canon Cat) are closer in spirit to a PL for computers than the GoF pattern catalog.
- ncmncm 6y agoEach design pattern documents a weakness in the language or omission from the library, such that the pattern cannot be or has not been pulled into the library. Weaker languages usually get a new feature when the pattern is recognized. Stronger languages get a new library component, if it can be expressed well enough, or sometimes a new feature. Some languages have ossified, accepting neither new core features nor library components, and code in them is all-over patterns.
- tabtab 6y agoAmen! Java and C# are too "stiff" to handle many kinds of changes/expansions that say Smalltalk or Lisp would have no problem with. Lambda's and "annotations" are doing many things that objects should be doing so that special additions or inconsistent parts are not needed to plug the holes. Make blocks of code just be blocks; and how they relate to other blocks be a library or code configuration instead of a block "type" or language construct because types don't handle combinations of traits very well: they like clean hierarchies to work well. But hierarchies are limiting. It's why RDBMS replaced IMS, for example. The same lessons apply to code blocks: hierarchies are too stiff for non-trivial change management. The scope profile/ranges and "parent pointers" of each block should either be dynamic or configurable just before compiling[1]: "This block has traits X, Y, Z, etc.". A buffet instead of numbered dishes. The boundaries between "object", "class", "lambda", "function", "annotation", etc. should be blurred and mixable. Don't force hierarchical or stiff taxonomies unless you really have to. We've outgrown trees just as we outgrew IMS. Block "types" are an archaic concept that the future will laugh at like they do to go-to oriented code now. (I'm currently experimenting with a "meta-language" that has TypeScript-like syntax but lets the libraries define how blocks behave instead of the language itself. You can make your own control structures and block types any way you want via just library changes...if things go to plan. Some say, "why not just use Lisp?", but too many find Lisp hard to read. This meta language thus borrows syntactical elements from the C family. Parameter blocks are visually different from code blocks, for example, giving the eyes more cues.) [1] Or both. Perhaps have "locked" blocks and unlocked blocks that can change their scope/parent configuration during run-time if given permission to do so. But that's Phase II. Phase I should keep it simple until the idea gets road experience in compiled languages.
- dexwiz 6y agoDesign patterns fill a similar niche as recipes. You have learned the fundamentals, control flow, data structures, algos, etc, but you are t sure how to put that all together. After learning the fundamentals of cooking, you can start exploring different recipes. Most of them are instructional and assume a base level of knowledge like what golden brown or finely diced means. They let you use your skills to make something physical. Design patterns fill a similar niche, somewhere between abstract concept and concrete code. What differs is that most recipes can be made without prior dependency. You can make chicken for dinner no matter what you made before. Large software projects aren’t like that. When deciding what to do you have to consider what you and your coworkers made for every previous meal. This makes a recipe much harder to choose, and often ends up as square peg/round hole. On the flip side most people start with recipes and only after much trial and error so they learn how to cook.
- cowanon22 6y agoI think the book "Fundamentals of Software Architecture, an Engineering Approach" (Oreilly) is much closer to what most engineers need today than the GoF book. It covers topics such as layers, pipelines, microkernels, events, microservices, components, and how to put it all together into a coherent design. GoF was great for it's time and context, but the world has moved on and even mid-level engineers need to be aware of software architecture and how to put it all together.
- shoo 6y agoPrior HN discussion of Christopher Alexander: https://news.ycombinator.com/item?id=17480178 https://news.ycombinator.com/item?id=17480178
- dang 6y agoIf curious, past threads: “Design Patterns” Aren't (2002) - https://news.ycombinator.com/item?id=12849757 https://news.ycombinator.com/item?id=12849757 - Nov 2016 (122 comments) Design patterns aren't - https://news.ycombinator.com/item?id=2675551 https://news.ycombinator.com/item?id=2675551 - June 2011 (30 comments) "Design Patterns" Aren't - https://news.ycombinator.com/item?id=284503 https://news.ycombinator.com/item?id=284503 - Aug 2008 (18 comments)
- Xunjin 6y agoIt's funny the comments growth, will this one beat the 122?! Could this be used to show hacker news growth, well I wonder :P Ty for helping like always dang, doing God's work.
- myth2018 6y agoI think the slides are great, I've just learned something new and I got interested on knowing more about Alexander's work. Also, I've got that the point is that we need to take a fresh look at Alexander. But one thing I never really understood is the criticism on Design Patterns as being workarounds for languages weaknesses. Of course you have languages at different levels of sophistication, and there's nothing wrong on pointing out that pattern X isn't needed on language Y since it already natively provides a proper solution, but what demerit would there be in using the pattern on a language which doesnt provide a good solution by design? Besides, GOF even speculate that some patterns could eventually become part of future languages, so I dont know, even if patterns can really be taken as "workarounds", it seems to me that it's everything much more about a gradual, natural evolution towards better languages.
- hcarvalhoalves 6y agoI have read Christopher Alexander’s bibliography and also had this impression that software people got it “wrong“. The patterns on GoF aren’t really at the same level - an “Iterator” is too low-level and not at all the level at which you would be discussing architecture with the end-users, which is the point of C.A. They focused on pattern “reuse” because that’s what the industry and OOP obsessed about - in the end reuse happens at package-level, so the industry missed the mark. In fact, it surprises me the focus on “A Pattern Language” at all when the “Notes on the Synthesis of Form” is a much relevant book on the topic of gathering requirements, prototyping and designing solutions. Anyway, I recommend going straight to the source and reading Christopher Alexander’s work as it’s very relevant for anyone designing solutions of any form.
- HelloNurse 6y agoThe GoF design patterns are low level, as noted in earlier comments, with respect to the standard of using them to communicate between software designers and software users, but also sufficiently high level to be nontrivial techniques in a certain class of OOP languages (Smalltalk, old C++, Java). They deserve an explanation, help the programmer to reason about architecture "from the bottom" and explain technical issues concisely, and serve as examples of more general good design principles. They have also proved to be a positive driving force in the evolution of programming languages and libraries. More "important" design patterns, such as organizing an enterprise application around executing transactions against a database or stipulating whether a soft realtime application like a videogame should lag or skip frames when overloaded, are usually too abstract and complex to give universal advice about.
- AtomicPlayboy 6y agoI found the presentation quite useful, and have a few thoughts on the points I found. First, my thoughts on Design Patterns as defined by the GoF. As recurring concepts which have been identified, named, and allow for higher-level discussion and solving of software architecture and design problems (I think this view of mine might be a bit short-sighted), they are great tools and vocabulary. However, they are known to reflect shortcomings, specially in object-oriented languages as opposed to functional ones (haven't read much about them, and I don't know much about functional programming and haven't yet read my copy of SICP, so I probably lack some fundamentals on the subject). I like the point about design patterns not being "patterny" enough, I think that was one point in the presentation. Although design patterns sure aren't too be taken simply as implementation recipes (is it too far a stretch if I think of them as a kind of "framework" or "frameworks"? Not sure about the inversion of control aspect, though) and there is no fixed Observer, or name-your-pattern implementation, it certainly would be more useful if they could be implemented only once instead of repeatedly for each new project. This is not "human", and that sounds fair enough to me. Some are actually reusable, such as certain library implementations or language constructs (I'm thinking of Java's foreach, I'm not familiar with Perl). I think that depends a lot on what constructs or building blocks the language provides. The first few pages of SICP make such a point about powerful languages. So it would be great if design patterns could be provided and reasoned upon as powerful language constructs (i.e. which are provided by the syntax). The higher level we can reason upon and solve problems, the better. So many things are patterns beyond the GoF ones. Paradigms, for one thing. Variables. The other point I found is about how Christopher Alexander wanted the clients of the building to reason upon architectural issues at various levels and how this also applies to software development. This could map either to the developers or to the end-users in my opinion (not to mention the hardware designers). Either way, I think this emphasizes the importance/need of higher-level constructs (such as the concept of information hiding applied to higher-level building blocks) than we usually reason upon when developing software. These were the useful points I could find. I'm afraid, though, that I don't have enough conceptual building blocks myself to reason further upon it. Finally, sorry about the lots of "reasoning upon".
- galaxyLogic 6y agoHow about: Design Patterns are like start- and end-games in Chess. They only apply in specific yet commonly recurring situations. You study them to be able to apply them when the situation seems ripe for their application
- keithnz 6y agothis talk that christopher alexander did a number of years ago is quite interesting https://www.youtube.com/watch?v=98LdFA-_zfA https://www.youtube.com/watch?v=98LdFA-_zfA one of the interesting things is that he had really moved on from "patterns" and was looking for something more intrinisic or "atomic" about design. Which actually is a much better guide to designing software.
- satisfice 6y agoThis is a useful post. The key idea I get from it is to mind the difference between dictating a solution and creating a vocabulary and set of models for discussing solutions.
- amatheus 6y agoThe way OP talks about what's Alexander's design pattern they look to me more like Domain Driven Design, that is, creating a common vocabulary to be used between developers(architects) and people who will use or needs the software(people who will live at/use the building).