Article Discussion
How to Use Design Patterns
Summary: Among developers, design patterns are a popular way to think about design, but what is the proper way to think about design patterns? In this interview, Erich Gamma, co-author of the landmark book, Design Patterns, talks with Bill Venners about the right way to think about and use design patterns.
9 posts.
The ability to add new comments in this discussion is temporarily disabled.
Most recent reply: March 16, 2007 10:45 AM by hassan
    Bill
     
    Posts: 409 / Nickname: bv / Registered: January 17, 2002 4:28 PM
    How to Use Design Patterns
    May 22, 2005 8:00 PM      
    Among developers, design patterns are popular way to think about design, but what is the proper way to think about design patterns? In this interview, Erich Gamma, co-author of the landmark book, Design Patterns, talks with Bill Venners about the right way to think about and use design patterns.

    Read this Artima interview with Erich Gamma:

    http://www.artima.com/lejava/articles/gammadp.html

    How do you use design patterns in practice?
    • Mike
       
      Posts: 1 / Nickname: mikedunbar / Registered: June 17, 2004 2:38 AM
      Re: How to Use Design Patterns
      May 24, 2005 6:29 AM      
      Good to see another interview here, seems like it's been so long and I really miss them!

      Really appreciate the questions and response around the real value of patterns, and how to use them.

      Erich Gamma: I think patterns as a whole can help people learn object-oriented thinking: how you can leverage polymorphism, design for composition, delegation, balance responsibilities, and provide pluggable behavior...

      Very important aspect of patterns. My personal observation is that OO is still, by and large, poorly understood and implemented. So many projects lack basic ingredients like abstraction and separation of concerns, resulting in tangled messes that are a nightmare to maintain.

      The emphasis on pragmatic use of patterns was very good to hear, especially from one of the original gang:

      Erich Gamma: ..Do not start immediately throwing patterns into a design, but use them as you go and understand more of the problem....I saw in a news group someone claiming that in a particular program they tried to use all 23 GoF patterns...

      This sort of pattern abuse has turned off many people from patterns altogether, which is very unfortunate. Even if a small percentage of patterns is actually needed on a given project, you still need to understand them, so you know when to use them:

      Erich Gamma: ...Patterns are distilled from the experiences of experts. They enable you to repeat a successful design done by someone else. By doing so you can stand on the shoulders of the experts and do not have to re-invent the wheel...People should learn that when they have a particular kind of problem or code smell, as people call it these days, they can go to their patterns toolbox to find a solution.
      ...
      A lot of the patterns are about extensibility and reusability. When you really need extensibility, then patterns provide you with a way to achieve it and this is cool. But when you don't need it, you should keep your design simple and not add unnecessary levels of indirection. One of our Eclipse mottos is that we want extensibility where it matters.


      Look forward to the remaining installments of this interview.
    • Daniel
       
      Posts: 1 / Nickname: migo / Registered: May 25, 2005 8:26 AM
      Re: How to Use Design Patterns
      May 25, 2005 1:45 PM      
      To Joost de Vries:

      There are many more patterns, have a look at the book about Java Enterprise Patterns, and of course, not all pattern are published by the GoF. Most other sets of patterns that I saw, are developed for niche-programming, btw.
    • caojie
       
      Posts: 1 / Nickname: chargie / Registered: May 28, 2005 0:45 AM
      Re: How to Use Design Patterns
      May 28, 2005 5:13 AM      
      We are having the "software design" course in which we are taught about the patterns with the textbook of "Head First to Design Patterns".

      Having learnt some patterns as Strategy, Observer, Decorator and others, and having finished an assignment which require us to design a command runner, I think the value of patterns is not only teaching us how to convert them into codes, but also and more important and essential expanding our view and thought when we try to solve some real problems.

      As for the use of design patterns, I hold the opinion as " more practice more expirenced".
      • vignesh
         
        Posts: 1 / Nickname: vignesh / Registered: May 28, 2005 8:20 AM
        Re: How to Use Design Patterns
        May 28, 2005 0:23 PM      
        "Head First Design Patterns" rocks !!

        Its a very good book especially for beginers and evn for people who are not quite affluent with all the patterns :)

        But as one person mentioned, the more experience you have the more better are your chances of understanding and applying these patterns

        hari
    • Joost de
       
      Posts: 15 / Nickname: yoozd / Registered: May 15, 2003 4:13 AM
      Re: How to Use Design Patterns
      May 23, 2005 8:22 PM      
      I'm surprised that the Design Patterns by GoF are still considered, by the head-first book for instance, to be the only design patterns.
      Is the GoF book complete?
      • Douglas
         
        Posts: 1 / Nickname: dwbass / Registered: February 23, 2004 2:39 PM
        Re: How to Use Design Patterns
        May 25, 2005 9:45 PM      
        In the time since GoF was published, there has been an explosion of design patterns, and a number of books organizing them into categories. Martin Fowler has mentioned that there are patterns for particular contexts. His enterprise patterns book, for example, could be thought of as the enterprise version of GoF, but it has nothing to do with software patterns for cell phones, PDA's etc.

        When people started cooking with a new food, various kinds of pain was experienced, and a number of recipes emerged as solving the pain. It seems to help to consider a design pattern as a successful recipe.
        • Joost de
           
          Posts: 15 / Nickname: yoozd / Registered: May 15, 2003 4:13 AM
          Re: How to Use Design Patterns
          May 29, 2005 2:11 AM      
          Hi Daniel & Douglas,

          Thanks for your response.
          I'm aware of the Patterns of Enterprise Architecture book, and of the PoSA books.
          It's just that PoEA represents patterns of a different, larger, granularity.
          The fun part of design patterns is that they are very low level, almost language level, and can be applied in any kind of application. What I meant to say is that I'm surprised that every pattern-teaching book, like the head-first book, seems to rely on the set of patterns as stated in the GoF book. I'd be interested in new low-level design patterns.
          But maybe that well is empty.
    • lxwde
       
      Posts: 1 / Nickname: lxwde / Registered: January 24, 2005 7:20 PM
      Re: How to Use Design Patterns
      May 30, 2005 11:14 PM      
      hi,Bill

      i'm thinking of translating this conversation into chinese and put it on my blog(of course none commercial use), but i don't know whether this will violate the copyright of Artima.
      • hassan
         
        Posts: 1 / Nickname: alhgamy / Registered: March 16, 2007 5:25 AM
        can any body help me?
        March 16, 2007 10:45 AM      
        i have one quetion .
        how make program by c do summition first five prime of numbers by call function to do that via recursion.
        pleas help me i`m student if any body solve this can send the soultion to my Emil:nemses2004@yahoo.com