views:

85

answers:

5

Is it possible for YAGNI to apply in the past tense? You created some functionality, it was used a little bit a while ago, but you aren't using it any more, and you don't want to maintain it, so you'd rather delete it.

Is getting rid of unused or rarely-used functionality neccessarily a bad thing?

Background:

  • I use source control, so if I need the functionality again, I can get it.
  • I'm the only user of my software (I'm a bioinformatician analyzing a data set).
  • One scenario where I came across this was that I was using inheritance, with a parent class, and two child classes. One was handling files generated by 454 sequencing (next-generation sequencing), and the other was handling files generated by Sanger sequencing (previous-generation sequencing). I was actively maintaining the latter, but not the former. Maybe my mistake was using inheritance rather than composition, but that's a slightly different story.
+5  A: 

Unused code is subject to 'code rot' - it's completely legitimate to remove it as a refactoring step.

Some additional discussion on C2's YAGNI and Deleting page.

That said, I find myself generally being conservative with culling dead code, but that's something that maybe I need to work on...

Michael Burr
+1: Delete early and often. Once it's "old" and you think you might need it, you're going to rewrite it anyway.
S.Lott
+1  A: 

All the reason why you should not write code that is not used apply also to why you should not keep around code that is not used. If you ain't gonna need it, don't keep it around. :-)

Franci Penov
+3  A: 

Dead code is expensive in many ways.

The thing that bothers me the most is the friction and added labor it causes when refactoring.

Press the delete key. If you need it later, go to SCC and get it.

Sky Sanders
+1  A: 

Novice programmers are proud of the new features they've coded. Master programmer is content when he's able to remove a feature.

Domchi
+1  A: 

Delete it. How about a new acronym, YGRKI - You're Gonna Regret Keeping It?

Carl Manaster