Thursday, May 10, 2012

Lazy Class : Does not have any purpose in the Matrix.

There is a very nice saying in the movie matrix, every thing is the matrix has purpose, other wise its been deleted by the agents. Believe we also create purpose less classes in our projects. as we all can guess the purpose of this discussion is to take a small note on “Lazy Class”

Here is what Wikipedia has to say about Lazy Class.

“A class that does too little”

This particular code smell is also known as freeloader. A Lazy class does not start from the beginning, And had definite purpose, but after some move method and refactor the class gets so smaller in size and the minor functionality that it has can be offered by another more meaning full class, or perhaps it already offered by some one other class already. So it end up with doing nothing at all.

So we don’t feel pity about it and can delete the lazy class.

How to eliminate Lazy Class?

Use “Collapse Hierarchy” or “Inline Class” to eliminate this code smell.

No comments:

Post a Comment