tags:

views:

59

answers:

6

We've had a slight change to our system which means what used to be two related business rule are now the exact same rule. Because of this, I've generalised the implementation and I'm wondering what to do with the old specified classes related to them.

Is it lazy to leave the old classes lying around and just inheriting the new generalised version (with no extra content, just empty classes)? Or is it sensible because it saves a good deal of refactoring?

The interface is the same regardless - so I'm curious : epically lazy, or cunningly avoiding unnecessary refactoring?

+2  A: 

Get rid of the extra class. What's the purpose of keeping it?

Don't your refactoring tools handle this for you?

John Saunders
No, sadly the refactoring tools wouldn't, because the clients of the classes are also in other systems. They effectively form part of the (undocumented! Yay!) public interface.The systems are internal so I can in all rights remove them and get everyone to use the new ones, but I'm not sure I want the headaches involved.
Massif
It's sometimes worth it - this way, you'll find out who uses your stuff. OTOH, if you do this, then you have no excuse to not document your new API.
John Saunders
+4  A: 

Get rid of it. That is the point of source control. If you ever need to refer to it, it'll be in the history.

Ray Booysen
+1, I'm tired of saying this at work, where everyone keeps lots of code commented "just in case I'll need it"... WE'RE UNDER SOURCE CONTROL YOU KNOW ?.. ahem.. sorry. Anyway, +1
Clement Herreman
That said, it could be useful to have a comment naming the revision where the code they "might need" can be found, to save them having to hunt through the logs later.
Adam Bellaire
+2  A: 

If the code doesn't do anything, get rid of it. Source control will keep the history for you should you ever need to refer back to it.

Chris Ballance
A: 

Even if you don't have something like Resharper, you can use VS.NET's "Find Usages" tool. Then update all usages to the new class.

Alternatively, just delete it and fix the compile errors. A.k.s "poor man's refactoring".

Neil Barnwell
+2  A: 

imho, clean, readable and concise code should be ever developer's goal aside from meeting the business requirements. That said, I would deprecate the classes, and make a task to refactor when time allows. Deprecating the class will help developers to know what class should be used.

Jay
+1  A: 

From pure OO design perspective, you should clean up the code.

From software delivery perspective, there are reasons why you may not want to do that:

  • Minimize amount of unnecessary changes to the code. helps with investigations in production issues.

  • Save the opportunity cost of re-factoring and use it on something more beneficial.

DVK