Tuesday, December 27, 2005

What's Your Favorite Design Pattern

Once in a job interview, someone asked me "What's your favorite design pattern?". I was first surprised at the question. Usually a design pattern is about solving a problem not about a personal preference. I wondered if it was a trick question of some sorts. I was hesitating with my answer and asked more about the meaning of the question. I just had to really give the pattern I liked the most! I really should not have but I ended up pleasing my interviewer and said "the decorator pattern". At least its name is somehow related to arts.

Then he said his favorite one was "the template pattern". He was really into it because he could use it anywhere. For him it was like the best thing since sliced bread.

Sheesh! just an abstract class. What kind of pattern is that!?! Design Patterns discussions can be really dull.

4 comments :

  1. +1 for decorator

    ReplyDelete
  2. +1 for Strategy
    I use it everywhere to encapsulate behaviour and it's massively used in IOC containers.

    ReplyDelete
  3. Hehehe. I saw your blog title (on javablogs) and muttered to myself "another frickin idiot with a favorite design pattern". But then I read the abstract and clicked through to read the whole entry.

    Bravo! The way I see it, patterns are all about increasing communication by expressing things in a higher level language. That's about it. Having a favorite pattern is a big red flag for me, and shows that someone is looking for how to insert patterns into their work, instead of attempting to recognise patterns that exist there already. I seem to recall somehing about round pegs and square holes.

    Though I will have to tell you my favorite pattern now . It's the "Get It F**king Done" pattern ;)

    ReplyDelete
  4. Let's self-congratulate ourselves Tim! I am amazed I got people giving their favorite patterns in this entry comments.

    I wonder if this is a joke or if they can't read or if I am just too bad at writing.

    ReplyDelete