Slashdot Mirror


'Design Patterns' Receives ACM SIGPLAN Award

bth writes "ACM's Special Interest Group on Programming Languages (SIGPLAN) recently awarded the 2005 Programming Languages Achievement Award to Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides (known as the 'Gang of Four') for their creation of 'Design Patterns' (the computer science book and the subfield at the intersection of programming languages and software engineering). The annual award recognizes an individual (or individuals) who has (have) made a significant and lasting contribution to the field of programming languages."

39 of 223 comments (clear)

  1. As mentioned by Paul Graham by putko · · Score: 3, Interesting
    --
    http://www.thebricktestament.com/the_law/when_to_s tone_your_children/dt21_18a.html
    1. Re:As mentioned by Paul Graham by whatthef*ck · · Score: 3, Insightful
      As mentioned by Paul Graham, in his essay "Revenge of the Nerds", Peter Norvig found that 16 of the 23 patterns in Design Patterns were "invisible or simpler" in Lisp.

      If I could make a decent living coding in Lisp, I might actually give a shit.

    2. Re:As mentioned by Paul Graham by Brandybuck · · Score: 2, Insightful

      Of course :-)

      Language bigots always think they're language is perfect. They even seek out its imperfections just so they can figure out how to recast them as perfections instead. Language bigots are among the most prickly people. Even moreso than editor or OS bigots. Prick them and they explode.

      Lisp is a great language, but it's not suitable for most mainstream programming tasks. Sorry, but it's not.

      --
      Don't blame me, I didn't vote for either of them!
    3. Re:As mentioned by Paul Graham by be-fan · · Score: 2, Informative

      The loop macro itself is an acquired taste, but Lisp doesn't have any particular problem with it. C++ programmers try to find a "for loop" in Lisp, but there isn't really an equivalent. There is a 'for' macro of course, but it's not like in C++ where its used for all iteration, even when it doesn't really make sense. Instead, Lisp programmers use a range of iteration techniques that fit the bill. They use map, mapcar, for, dolist, etc, whichever makes sense in the given spot. In Lisp, there is almost always an iteration construct that expresses exactly the iteration you want to do, without you having to try and figure out how to express your iteration in terms of 'for'. Of course, if there isn't, you can always use loop, or write a macro to roll your own.

      --
      A deep unwavering belief is a sure sign you're missing something...
    4. Re:As mentioned by Paul Graham by shmlco · · Score: 4, Funny
      I just can't help myself given that sentence. To quote, "Language bigots always think they're language is perfect."

      Yes, language bigots always think THEY ARE language is perfect.

      --
      Any sect, cult, or religion will legislate its creed into law if it acquires the political power to do so.
    5. Re:As mentioned by Paul Graham by be-fan · · Score: 2, Insightful

      What's your reasoning behind the assertion that Lisp isn't suitable for most "mainstream programming tasks". Just saying it doesn't make it true.

      I don't think any real Lisp user will tell you that Lisp is perfect. There is a litany of complaints your average Lisp user has about the language (even Paul Graham). However, most will tell you that its definitely better than what exists in the mainstream. Lisp users are kind of like Linux users in that way, actually. Feature for feature, mainstream languages just can't compete with Lisp. And it's not just a Lisp thing. Listen to Python or Ruby folks talk about how much more productive they are in those languages versus Java or C++. There is a reason for that. It's because those languages are more like Lisp.

      --
      A deep unwavering belief is a sure sign you're missing something...
    6. Re:As mentioned by Paul Graham by be-fan · · Score: 4, Informative

      You're right, design patterns aren't duplicated code. They're duplicated patterns of code. Nearly all languages have a tool for handling duplicated code (functions), but few have tools to handle duplicated patterns of code. Lisp macros, however, do allow you to codify patterns in code.

      Lisp macros and C macros share only a name. The C preprocessor is just a simple text-substitution mechanism. In comparison, Lisp macros are functions that take source code as input, and return source code as output. They have all the generality of regular functions, except the compiler invokes them at compile-time to expand calls.

      The simplest examples of Lisp macros are defining new control structures. For example, Lisp has no direct equivalent of Python's "for elt in container" syntax. However, it's easy to write a macro that takes the statement (for (x in list) ...)" and expands it to an iteration using Lisp's native 'do' loop. Now, that's just scratching the surface of macros. Since macros are just functions, you can do anything with them, including writing a language on top of Lisp. This might seem like a bit of a strange idea, but domain-specific languages are hardly a new concept (ie: SQL), and its easier to build them on top of a mature platform instead of writing your own compiler.

      With regards to macros and patterns, an easy way to think about things is to realize that functions are useful when you need to apply the same code to different data, while macros are useful when you need to apply the same structure to different code. The classical idea is that you can't package up design patterns into a library. That's because few languages have macros (ie: functions that operate on source code). When you have such a feature, packaging up design patterns becomes easy. Just codify the invariant parts into the macro, and put the parts of the code that change as parameters to the macro. If you've read Alexanderescu's book "Modern C++ Design", you'll see that this is precisely what he does with C++ templates (which are a limited and kludgy form of macros). This is big news in the C++ world, for the simple reason that it makes code less tedious to write and less error prone.

      --
      A deep unwavering belief is a sure sign you're missing something...
    7. Re:As mentioned by Paul Graham by be-fan · · Score: 2, Informative

      Your point is well taken, but note that your problem is basically a combination of lacking documentation and you still learning the language. The first is the fault of the language (well, the implementation, but still), while the latter is nobody's fault, because it's an inevitable situation. I would assume that if you were on the clock, you would already know the language you were working in. Ie. if the project were in C++, you'd already know C++, or else you wouldn't have gotten hired to work on it.

      What implementation are you on, anyway? Depending on what kind of networking you need, the trivial-sockets library could be up your ally. Very simple way to connect Lisp to a network. If you're on SBCL, there is SB-BSD-SOCKETS, which exports an API pretty similar to standard UNIX sockets. Of course, for the best in documentation quality, springing for a copy of Allegro CL will get you the ACL socket API. Since you're a student, you can get a copy for a mere $99, or about what you'd pay for an academic version of any other commercial software.

      --
      A deep unwavering belief is a sure sign you're missing something...
  2. terminology, methods, what? by Rubel · · Score: 5, Insightful

    I've worked with a couple of folks who swore by this book, but I never really heard much from them about why. Is it about good algorithms? Or larger design issues (such as)?

    Or is it more about just giving programmers a common vocabulary with which to discuss the way they bulid software?

    Is it good reading for an amatuer programmer, or more as an advanced topic?

    1. Re:terminology, methods, what? by smittyoneeach · · Score: 4, Informative

      It serves as a common language for designers to talk about what they're doing.
      It gives standard terminology for talking about, among other things, how you'd implement an undo function in an application.
      However, such standardization flies in the face of the need to re-invent the wheel and sell it as a shiny new technology.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    2. Re:terminology, methods, what? by IntergalacticWalrus · · Score: 2, Informative

      It's all about "design patterns", ie. the sorting and naming of common design problems a programmer has to face in object-oriented programming, and how to solve them right, so the code remains as maintainable and cohesive as possible.

      For anyone doing object-oriented programming, this should be required reading IMHO. It gives you a solid base on how to solve most moderately complex problems.

    3. Re:terminology, methods, what? by fermion · · Score: 3, Insightful
      I think it is about idioms. There are standard ways to copy, iterate, and count. These standard not only make the code more readable, but also provides time tested methods to make the code reliable. Also using these idioms when writing code speeds up the process. There was a time when I could at sketch out a solution to a moderately complex problem in a day, flesh it out in another day or two, and then spend the rest of the time debugging and clarifying.

      When we moved to OOP, new idioms were needed. We kept many of the old ones, and the OOP made complying with some rules, such as the separation of data, presentations, and manipulation, simpler. This is what design patterns does. It provides a set of idioms that can be applied to classes of problems. Once these are learned, one should be able to quickly develop a robust solution.

      Take for example the singlet. It is a simple construct used when only one instance of an object is allowed. This happens more than one might imagine. I could sit down and think hard for a while and implement singlet, and then redesign, and debug, and after months of work come up with a good solution. Or I could just use the design pattern and in 20 minutes implement my singlet class.

      The second part of you question is more complex. I, like most programmer, created crude versions of the design patterns on my own before reading this book. I even saw I enforced some OO concepts on my structured programming. Once I read the book I quickly saw the uefulness and began to use the patterns in my professional work. OTOH, when I was coding some math stuff over the summer, I did not use the patterns because the work was not so suited to the patterns. If i were to publish the work, I might go back and rework to fit the idiom. OTOH I know that the book is used widely and knowing the basics are useful. So if you are coding for fun, it might not help that much. If you are coding to show others, it would help to put the code in a form people will recognize.

      --
      "She's a scientist and a lesbian. She's not going to let it slide." Orphan Black
  3. Well deserved by Sv-Manowar · · Score: 3, Informative

    Its good to see these people being recognized for contributing such a useful concept to object oriented programmers, and its wholly appropriate they should recieve such an award from a group focused on exploring "implementation and efficient use" of programming languages. Although they have their critics, Design patterns have surely helped many programmers greatly in this manner, especially in languages such as java.

  4. For OO fans... by William+Robinson · · Score: 4, Informative

    This site is one of the best.

  5. Oh dear... by groman · · Score: 3, Insightful

    Oh my

    The quite possibly most useless book in the history of computer science gets an award. Somehow I am not that surprised, considering that everybody hails it as the end all of object oriented design and everything.

    To be honest, modern computer science curriculum seems to be wasting a lot of bright young potential on buzzwords. Patterns, paradigms, bleh. People somehow manage to get masters degrees in CS from Berkeley without even knowing what "turing complete", "Karnaugh map", "Rice's theorem", "Goedel's completeness theorem", "planar graph", "functional language", "church-turing thesis" are. But you ask them about a singleton, model-view controller or Java's security model in reflection and they're the fucking expert.

    Well that's barely computer science, that's just OO banging. Just because it uses paradigms and object oriented terms doesn't make it anything other than advanced code banging.

    1. Re:Oh dear... by Anonymous Coward · · Score: 5, Insightful

      Of course it isn't Computer Science, it is Software Engineering. The book helps you design software systems. Can Karnaugh maps do that?

      I find it useful with what I work on. If you don't then, maybe the book just isn't for your line of work.

      Design patterns are a tool, not a silver bullet. Get what you can out of them but don't be surprised when doesn't solve all the problems in the world.

    2. Re:Oh dear... by TheGavster · · Score: 2, Insightful

      As a computer science major, I find it depressing that I only know what half those words mean, and I learned them all in electrical engineering courses. We really need to get back to "Computer Science is highly organized math" rather than "Computer Science is objects".

      --
      "Because Science" is one step from "Because old book". Try "Because of my experiment testing my falsifiable assertion".
    3. Re:Oh dear... by aftk2 · · Score: 2, Insightful
      Computer science curriculum seems to be wasting a lot of bright young potential on buzzwords. Patterns, paradigms, bleh. People somehow manage to get masters degrees in CS from Berkeley without even knowing what "turing complete", "Karnaugh map", "Rice's theorem", "Goedel's completeness theorem", "planar graph", "functional language", "church-turing thesis" are. But you ask them about a singleton, model-view controller or Java's security model in reflection and they're the fucking expert.
      Interesting - that you decry the popularity of "buzzwords" with a list of what are, essentially, buzzwords.

      *ducks*
      --
      concrete5: a cms made for marketing, but strong enough for geeks.
    4. Re:Oh dear... by cratermoon · · Score: 3, Insightful

      People with CS degrees seem to get jobs writing software for money without knowing a thing about security, testing, defect discovery and removal, team organization, refactoring, design, technical writing, communication, estimating, abstractions and complexity management, business practices, communicating with users... well, anything needed to actually deliver working software that delivers value to the business.

      But, you know, in case that trucking company struggling with logistics needs to know about "turing complete", "Karnaugh map", "Rice's theorem", "Goedel's completeness theorem", "planar graph", "functional language", "church-turing thesis", they're golden.

    5. Re:Oh dear... by SirSlud · · Score: 3, Insightful

      Face it; software is now a commodity business. Using an automotive analogy, if you want to improve the performance or design of the internal combustion engine, go for it, but most software jobs these days only requires putting a kit together rather than having to push the envelope of science.

      Therefore, sure, Computer Science is science, but understand that its pure semantics. Its good that enrollment in CS is down, because most of the CS students during the boom were more interested in engineering (applying known scientific discoveries) than the science itself.

      The fact that employers looking for programmers ask for CS degrees is simply an indication that the industry is still fairly young. Software engineers used to come out of CS, but that trend is rightfully dwindling. Most programmers really should be trained in an engineering course, where the focus on economics and social responsibility are more pronounced.

      --
      "Old man yells at systemd"
    6. Re:Oh dear... by Kupek · · Score: 2, Interesting

      Programming paradigm. It's the most appropriate word to describe the different families of programming styles/languages: procedural, functional, object-oriented, imperative, logic and such. It's commonly accepted; I've seen it in places ranging from textbooks to CS papers to Stroustrup's C++ book.

    7. Re:Oh dear... by Anthony+Liguori · · Score: 3, Insightful

      People somehow manage to get masters degrees in CS from Berkeley without even knowing what "turing complete", "Karnaugh map", "Rice's theorem", "Goedel's completeness theorem", "planar graph", "functional language", "church-turing thesis" are.

      You're obviously trying to come off as pompus but seriously, do you even really know what you're talking about? What's so important about Karnaugh maps? It's a silly way as solving a system of boolean alegbra equations. Only really useful for introduction digital circuit design.

      If you want to talk about boolean logic, talk about predicate calculus, modus ponus, or something that actually deals with Computer Science theory.

      I understand where you're coming from and don't fully disagree but you sound like an ass. There's always someone with a more theoritical background than you so just don't do that.

      FWIW, the GoF are important because they were the *first* to do what they did--give programmers a common vocabularily to describe complex systems.

  6. An Excellent Book by under_score · · Score: 2, Informative

    It surely deserves this award. However, after 15 years doing software development, I now consider two other books even more important even thought they are not quite as information-full as the design patterns book. They are: "Agile Software Development" by Alistair Cockburn and "Software Craftsmanship" by Pete McBreen. I have a full list of books, web sites and tools that I recommend at my Software Resources page.

  7. Excellent material, often taught incorrectly by bsandersen · · Score: 5, Interesting

    Congratulations to the GoF. Their observations of patterns of systems and behavior are well-described and well-cataloged in their book. I only wish the concepts and materials were conveyed better when taught.

    Most of the time people start with the attitude "Let's start with the Visitor pattern" or something like that. The point of the patterns movement is there are common things that are done, wouldn't it be nice if we could talk about them with common terminology and use the full richness of our experience to ensure when we see the problem again that we don't make all the same mistakes we made last time.

    I'd like to see it taught (and this can be in the programming shop, too) like this: "What are we trying to do? Where have we done something like this before? Doesn't this look like something we've done last month? Can you detect a pattern to all this?!"

    Instead, what I often see if people spouting pattern names like one would name-drop at a party--the more you drop the more important you must be. Starting with the problem to be solved, the understanding of same, and then recognizing that we've seen this before, then naming the pattern is less flashy but is more the intent of the GoF IMHO.

    1. Re:Excellent material, often taught incorrectly by Brandybuck · · Score: 2, Interesting

      Instead, what I often see if people spouting pattern names like one would name-drop at a party

      I'm seeing this at work, and it's driving me nuts. Our new Bible is "Architectural Design Patterns". The big push right now is to move to .NET because "it's enables Reflection."

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:Excellent material, often taught incorrectly by Brandybuck · · Score: 2

      Reflection is a nice pattern. But the ADP book treats it as an *architectural* pattern. As in, it defines the entire structure of your system. Consequently, the architectural team at my work is making a brand new system based on the reflection pattern.

      My coworkers aren't stupid, they've just getting a lot of positive feedback from their use of buzzwords.

      --
      Don't blame me, I didn't vote for either of them!
  8. worth it for one reason by bmac · · Score: 5, Informative

    The patterns themselves are not really that
    groundbreaking, IMO; the genius of the book
    is the perspective on looking at software
    as pattern definitions and then their use
    in different ways and places in software.

    The part that every OO developer should
    ingrain in their brain is to

    Prefer composition to inheritance.

    Good Lord, people love their inheritance
    when there are very, very rare situations
    that call for it. (Composition, btw, is
    where a data structure is used as a data
    member of the class).

    What it recommends is that instead of this:

    class cElement : cParent { ... }

    use this:

    class cElement {
          cParent mParent; ...
    }


    Inheritance is so friggin abused by OO
    developers, it is ridiculous.

    So, my recommendation is to read the first
    50 pages or so, which is their general
    perspective on programming. After that,
    it's just details about the patterns they
    have encountered in their careers.

    Peace & Blessings,
    bmac

    1. Re:worth it for one reason by Brandybuck · · Score: 2, Insightful

      Unless of course, cElement is a cParent. In that case inheritance makes sense.

      Using composition for everything is just as bad as using inheritance for everything. That inheritance seems to be your pet peeve, makes me think that you use composition much more than you should. Everything has its balance, but when you go out on a limb to tell someone else that he's unbalanced, make sure that limb doesn't break.

      --
      Don't blame me, I didn't vote for either of them!
    2. Re:worth it for one reason by Anonymous Coward · · Score: 2, Insightful

      Unless of course, cElement is a cParent. In that case inheritance makes sense.

      A circle "is a" elipse. Should a circle class extend an elipse class, even though a circle doesn't behave as an elipse (e.g., one cannot independently alter both axis and still have a circle). Nope. "is a" is not what matters. "behaves as a" is what matters.

    3. Re:worth it for one reason by plover · · Score: 2, Informative
      Even your example has a counter example.

      I just saw a presentation where the guy gave an example of a CSquare inheriting from a CRectangle. He said look at the differences: if your CRectangle has a SetSize(int height, int width) method, what do you do if the width isn't the same as the height? Perhaps you should have a SetSize(int side) method instead. But then it's still different enough that the two really aren't as related as they seem, even though a square is most certainly a rectangle.

      I agree that inheritance is overused. Yes, it has its place, but I think that place is in defining an interface rather than in trying to reuse functionality.

      --
      John
    4. Re:worth it for one reason by AveryT · · Score: 2, Insightful

      "Prefer composition to inheritance."

      More to the point, don't use inheritance when you mean composition. Inheritance models the relationship "IS A". Period.

      If the sentence "A Foo is a Bar" doesn't make sense or isn't true, you should never write the code:

      class Foo : Bar { ... }

      But this has nothing to do with Design Patterns; this is just OOP 101. Any C++/Java/C# developer who doesn't understand and practise this has fundamentally misunderstood the OO paradigm. Reading a book about GoF patterns at this point is probably just going to make matters worse.

  9. An observation... by bunyip · · Score: 4, Insightful

    "Some is good, more is better, and too much is just about right."

    - This mantra is good for money, horsepower, disk space, but not design patterns...

    When somebody starts telling me that they used 5 different patterns in their program and they're proud of it - then I know the code is crap. Most of the pattern zealots I've seen write bloated, inefficient code. Sometimes I think they scour the literature looking for some extra patterns to put in.

    That said, these patterns do exist and programmers keep reinventing them. The key is knowing when to call it a pattern and go to the trouble of formalizing it versus just writing code. Alternatively, find a language that makes most of these go away.

    1. Re:An observation... by arethuza · · Score: 2, Insightful
      Here is one pattern anti pattern that can increase the complexity of a project hugely. For each class:
      • Define an interface for the class to implement
      • Create a factory class that does nothing but call the constructor on the class
      • Define an abstract factory interface
      • Have a factory factory that creates instances of the factory based on a system property or properties file
      And do this for every class in your system!

      Design patterns are a great idea but they can lead to a huge increase in complexity when people feel that they have to blindly apply patterns for no actual benefit.

  10. Easily mastering design patterns by De+Lemming · · Score: 4, Informative

    The classic Design Patterns book is great, and the GOF certainly deserves this award. Still, the book is hard to read. And in daily practice, it's not always clear when to apply which pattern (especially for the less experienced).

    I'm reading Head First Design Patterns, published by O'Reilly, right now. It's an fun and easy to read Design Patterns course, which is difficult to put down once you started it. The authors have a great sense of humour, and use a very practice-oriented approach. They tackle day-to-day problems by starting with the obvious solution an inexperienced programmer would use. Then they point out the problems with this solution, and step by step they work to the appropriate design pattern. Patterns are examined from different viewpoints, and the authors try to answer all the questions you might have.

    I really recommend this book. In fact, I recommend the whole "Head First" series (I also own Head First EJB). These books are not usable as reference works, but they are wonderful for learning and mastering a subject.

  11. The problem with patterns by be-fan · · Score: 4, Interesting

    Patterns themselves are good to have in code, but the idea that they must be reimplemented for each case (as opposed to being packaged up into a concrete, first-class language object) really shows the limitations of mainstream languages. Peter Norvig (formerly at Harlequin, and now at Google) did a good writeup of the issue. Paul Graham also has an interesting take on this subject.

    --
    A deep unwavering belief is a sure sign you're missing something...
    1. Re:The problem with patterns by be-fan · · Score: 2, Insightful

      Undoubtedly. Design patterns are helpful in any code, they're just easier to use when the language is properly set up to handle it. Now, it's true that a lot of people can't afford to "non standard" tools. The potential for being blamed if something goes wrong is quite high indeed. However, my point was merely that mainstream languages are not ideally geared towards working with patterns. That does not mean that they'll always be that way, however. Mainstream languages are increasingly ripping entire pages out of the books of dynamic languages (eg: Java 1.5, C# 2.0). Over time, the tools will get better, and looking at what existing dynamic languages do know could give you an edge when the mainstream languages incorporate their features.

      --
      A deep unwavering belief is a sure sign you're missing something...
    2. Re:The problem with patterns by IvyMike · · Score: 2, Insightful

      If you program in C++, you should take a look at "Modern C++ Design" by Andrei Alexandrescu. To quote Herb Sutter's blurb off the back cover, "Fundamentally, it demonstrates 'generic patterns' or 'pattern templates' as a powerful new way of creating extensible designs in C++ -- a new way to combine templates and patterns that you may never have dreamt was possible, but is." Ultimately, he gives the reader pre-packaged generic implementations of several of the more common design patterns.

      Alexandrescu's pretty far out there on the bleeding of template usage, and many of the tricks he pulls are more complex than I'm willing to embrace, but it's a fascinating book nonetheless.

  12. Christopher Alexander: The true originator? by 0x1234 · · Score: 2, Informative
    When I was in college, an architecture student friend of mine suggested that I read two books by a guy named Christopher Alexander: A Pattern Language (1977) and Timeless Way of Building (1979).

    I'm fairly confident the concept of design patterns truly originated with these two books. The concept from architecture was then applied to software.

    The fundamental idea being that there are certain components of architecture that "just work" and "feel right". They may solve very complex problems in elegant and subtle ways. They are not usually designed, but instead are discovered.

    Interestly enough, I believe that Alexander himself wasn't an architect, but a physicist with an interest in architecture.

    I hope that Alexander was mentioned ;)

  13. Give it to Code Complete, instead... by javabandit · · Score: 2, Interesting

    Seriously. I think some patterns are fine for some things, but as a previous poster has stated, more ugly-as-shit code has been written using design patterns than not.

    I know that in the OO languages world, this book is hailed by many as the holy book, but to me, there really is only one... "Code Complete".

    The one book teaches the fundamentals of good programming *in any language* better than any programming book ever written.

    Case in point, I don't think any shit code has been written as a result of applying the techniques and best practices in "Code Complete". I certainly can't say the same about "Design Patterns".