Favorite Design Pattern? What the???

Posted on March 18, 2011


CC-by-SA [You can access this page via http://bit.ly/hkkcPZ]

Which is your favorite design pattern?

That is a question that comes up quite regularly in development forums. It is an understandable one among students learning the ropes. However, and quite troubling, the question is regularly asked by people who have been in the profession. And that, ladies and gents, it does not make sense. And here is why:

To say that X is your favorite thing out of a set of possible alternatives typically implies that your choice is in, many ways, optional and interchangeable in the general sense. For example:

  • My favorite color is purple.
  • My favorite rifle for shooting animals is a Winchester.
  • My favorite TV show is Master Piece Theater.

Now consider the following statements:

  • My favorite screwdriver is the Phillips one.
  • My favorite nail is the 6″ galvanized concrete nail.
  • My favorite medicine is Tylenol.

None of those make any sense because they are implying a favoritism towards a tool that has a specific usage, as if we had a choice to choose those tools over others, again, in a general case.

The same thing applies to a design pattern. If someone asks you what your favorite design pattern is, then either

  • it’s a trick question, and/or
  • that person doesn’t know what he’s talking about.

A correct question THAT IS NOT A TRICK QUESTION would follow or resemble one of these themes or lines of inquiry:

  • Which is the pattern you have used the most? Where and Why?
  • Which pattern can be used in X or Y situation?
  • What do you think of pattern X?
  • What is your experience with pattern X?

When the “favorite” question is presented, you have to tread carefully, in particular during an interview or in an internet forum (which is a searchable snapshot of your skills or ways of thinking.) My personal answer to such a question would be what I just said, that I cannot think of a pattern in terms of favoritism. I explain why and what kind of questions I would think make sense – bold and risky, but hey, a question that makes no sense or whose intent is blurry or problematic needs to be straighten out.

As usually attributed to Voltaire – “If you wish to converse with me, define your terms“.


Clarity of purpose should not be optional

One possibility of having a legitimate “what’s your favorite pattern” question is if the interviewer or questioner wants to know which pattern structure you find most elegant, coherent, concise, interesting or appealing. Typically, it is a way of prodding your sense of mathematical elegance (as once referred by Dijkstra[1][2][3]), analytical skills and/or computer science depth.

Other than that, I would look at such question with suspicion because classes of tools are not meant to be seen in terms of favoritism, but application.