Really getting design patterns

The CEO of my first company (who was an old time assembler/C programmer even before I was born) liked to periodically quote, “you either get pointers or you don’t”. I believe I’ve seen variants of that on the web – but I just did some Googling and could not find out who made the original quote (if there’s indeed someone who this is attributed to). Anyway I am not really talking about pointers here – I am talking about design patterns. The first time I read the GOF’s Design Patterns, I remember thinking that some of those patterns did look familiar and that I’ve used them without knowing what they were formally called. But I also remember thinking that some of the structural and behavioral patterns described in the book didn’t seem particularly useful – in fact I thought that it was just a big pile of complicated sounding text. But since the rest of the smart programming world accepted these patterns I remember worriedly pondering over whether I was one of those unfortunates who simply didn’t “get” design patterns.

Anyway I have re-read the book a few times now, some parts of it several times, some parts of it maybe a couple of times, and with each iteration I ended up with a “hey that makes sense now” feeling. I spent the last few days of this Christmas/New Year holiday re-reading the entire book and this was probably my best experience so far. I instinctively recognized familiar patterns that I had seen in use in MFC and the .NET class library, and I also began to understand certain patterns better (even those that I was previously sure I understood). I don’t think I’ve fully got it even now, but I have concluded that the key to getting design patterns is probably to apply them in many different scenarios and perhaps occasionally coming back to the book and giving it a quick read (1-2 hours should be good enough to scan the entire book and refresh your memory). And though design patterns is a subject that has been covered once too often in various blogs and articles I may occasionally blog about my attempts at applying known patterns to specific problems. That I guess would be my new year resolution (or at least one of a dozen others).

Advertisements

3 thoughts on “Really getting design patterns

  1. I look forward to them! I’m a big fan of design patterns myself and I’m still waiting for the day that I instinctively know them all by name… I find myself visiting dofactory.com all the time to figure out what certain patterns are… I’m a visual guy and that site has them all uml’ed up for me. 🙂

  2. Nish,

    I’m also on design pattern book of GOF. But it’s a bit hard. I’ve read it before partially, but it was a bit tough for beginners. Again I’m started reading that. As you said, it feels like making sense.

    Please share if you have any opinion on book “Head First Design Patterns”.

  3. Hello!

    Happened to stumble upon this article while surfing your blogs – interesting ones, indeed.

    Have read the GOF’s twice now. But, somehow cannot pin point the difference between Factory and AbstractFactory patterns. If you have cracked it, please blog about it.

    Greetz,
    Kiran

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s