Wednesday, October 20, 2010

Object Anti-patterns

Object design patterns are great but there are many pit falls from over engineering a system or creating designs that become menaces, They have become know as the Anti-patterns.

Im currently trying to explain why a class that lists its objective as "This can either be seconds-from midnight. Or a time_t with a date." is a very bad idea.

I dont understand why people dont get it. Its basically a "Staralised schema" IE one object trying to be both things at the same time... and violates the "Single Responsibility principle"

UPDATE:
I have tried exploring the issues that occur with the implementation of an operator+ for this dual purpose class with them but they seem tied to the idea that what is in disk MUST be represented as is in memory.

I have also explain that when the class is viewed in isolate it loses the format information related to the time. This is because the Time classes main use is as an aggregate data-member and the aggregator classes type gives an implicit indication of what the Aggregatees time format is... I have even shown them code that proves the point and exposes many of the problems. To all this effort they have responded with "well maybe you should write/use a whole new time class for that"..

The main reason why I am fighting this so hard boils down the fact that these guys control QA in the system, and unless I can change there minds the problem will remain and other coders will continue to created hacks that avoid issues. These hacks then have a knock on effect(violation of Encapsulation principle) and become maintenance nightmares later...

Refer:
http://www.worldlingo.com/ma/enwiki/en/Anti-pattern

http://en.wikipedia.org/wiki/Single_responsibility_principle

No comments:

Post a Comment