Friday, 13 April 2007

Anti-Patterns

“Use identify and apply strategy towards Patterns and identify and remove for Anti-patterns” Dr M.G. Sri.

As we know patterns are good, effective solutions to a problem, identified, practiced and designed for reuse. However Anti-patterns are bad, ineffective solution to a problem identified and documented for others to avoid. Anti-patterns are useful not only because they notify you about the bad practices but also because it informs you about the ways to change the solution into healthier one if you find yourself caught up with an anti-pattern.

A good example of anti-pattern is spaghetti code, where the code is messy, difficult to read, modify and reuse. Another example is God Object Anti-pattern, where lot of other objects, operations and methods are handled by this object. Now these are bad practices and knowledge of them are useful for every programmer to avoid these ‘pitfalls’ at first place.