Monday, October 10, 2005

Program to an Interface or Design Pattern

Nowadays, I often hear people saying I used the X design pattern, Y design pattern giving a lengthy list of all the patterns. But when asked what is the motivation behind using a particluar pattern, there is always a stunning silence. Most of the developers these days want to make their resume impressive, so they use every available api and design patterns. The outcome is code that is not readable, bloated and not maintenable.

This reminds me an incident in a well known Telugu movie - the hero wants to learn the fine points of a martial art and want to avenge the death of his brother. The master asks him to realize that the true meaning of the martial arts is Non Violence. The analogy many not be apt, but sensible developers should realize that the design patterns help in producing code that is adhering to the OO principles and code that is maintenable.

1 comment:

Vijay said...

A couple of points
IMHO I would say rather than use of design patterns the abuse of design patterns is prevalant, reminds me of saying "If all u have is a hammer everything looks like a nail"

The question of where you want to apply a design pattern
and in my experience I"ve found that most of these design patterns need to be tweaked a lil to apply this to a particular situation .Very rarely have I come across where there is a direct application of the design pattern to the problem in hand . As said the motivation behind the pattern needs to be understood to make an exact fit.