Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

How to Use Design Patterns

Bill Venners just posted Part 1 of an interview with Erich Gamma called How to Use Design Patterns. So why should developers learn patterns?



“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. Patterns go beyond applying objects to some graphical shape example, with a shape class hierarchy and some polymorphic draw method. You really learn about polymorphism when you’ve understood the patterns. So patterns are good for learning OO and design in general.”


Learning about patterns is also learning about Object Orientation, since patterns are OO applied to certain types of problems. Erich really liked the Head First Design Patterns book as a resource for learning patterns.


Developers just starting to learn design patterns often suffer from design pattern-itis, that is, they think “I need a new object, so I’ll use an Abstract Factory.” But don’t start your application with patterns:



“Do not start immediately throwing patterns into a design, but use them as you go and understand more of the problem. Because of this I really like to use patterns after the fact, refactoring to patterns.”


That is why Joshua Kerievsky’s book Refactoring to Patterns is such a crucial book. (I haven’t studied it extensively yet, but I’ve read parts of it and it’s excellent.) Not starting with patterns allows the architecture to emerge around an application’s abstractions:


“That’s something you can often observe in mature designs. There are some key abstractions you often see as a design center, and around those key abstractions you want to achieve various things. So you see patterns growing out of such a center.”

This entry was posted in Agile, TDD. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

5 Responses to How to Use Design Patterns

  1. See also my Software Quality blog:
    http://software-quality.blogspot.com/2005/06/how-to-use-design-patterns.html

    The goal is a clean, easy to understand API, not to win an I-used-the-most-patterns contest.

    About refactoring to patterns: “you have to feel the design pain first.”

  2. I have raise issue of Design Patterns and VB.NET developer here http://ipattern.com/simpleblog/PermLink.aspx?entryid=32 Does a VB Developer need to learn Design Patterns?
    This arctile has actual code to prove the point :)

    Maxim
    [www.ipattern.com do you?]

  3. darrell says:

    Brendan: I highly recommend them.

    Steve: I guess it doesn’t work for everyone, but considering some of the *dull* books I’ve been through before, it’s a refreshing change (in my opinion, ymmv :).

  4. shebert says:

    I was turned off by the “Head First Design Patterns” because the cover is almost comical. I remember hearing some say “don’t judge a book by it’s …….” Darn, I can’t remember the rest of that saying.

    I really like Gamma’s quote saying “Do not start immediately throwing patterns into a design.” That’s a great way to come up with a convoluted design and his abstract factory comment is especially timely today.

    I’m ordering both books as well. Nice writeup!

  5. btompkins says:

    I just put in an order for the two books. The Head First book looks really interesting…

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>