Jun 7, 2008

Common Software Design Blunders

Jun 7, 2008

I have been reviewing some of the codes at work (mostly my own ;) ).We make lots of " mind numbingly stupid" mistakes when designing a software, only to regret later.Here are my favourite ones.

Explicit object Instantiation: If your design involves instantiating objects from concrete classes, then there's a flaw already.This commits an application to a particular implementation instead of a particular interface , it complicates future (unavoidable) changes.

Visibility to (Server) Object Implementation: If a client module knows how an object is represented or Implemented, it tends (rather unknowningly) to a design which is more specific to object's implementation.Hiding this information from client is better design because even if implementation of the object used is changed or altered, there are no cascading changes on the client.

Algorithmic Dependencies: Algorithms are prone to changes in the name of optimization and often are replaced with better ones. Objects that depend on an algorithm will have to change whenever algorithm changes. Therefore algorithms that are likely to change should be isolated from rest of the lot.

Too much SubClassing: Subclassing requires an in-depth understanding of the parent class. Overriding one method might require overriding another and so on.Different ways of object composition would be a better approach than extending functionality by subclassing.

0 comments:

Post a Comment

Top Ad 728x90