Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Good method to handle large amounts of unused or deprecated feature implemenations in code

Tags:

deprecated

Currently we are facing following Problem in our Application:

Around 40 % of the Code that is in the Application is never used. That means the Code would be there, and maybe functional, but the Frontend Feature has been shut off so the Users cannot reach the Functionality anymore or other Methods are replacing the old, now deprecated Methods.

What i am currently doing is removing all the old code while not trying to break anything, manually.

The Question is:

  • Would you remove the old Code, or hope that it may awake some time ... zombie - like
  • Do you think that it is worth the Effort to remove the Code (less work to find stuff in the clutter, better test coverage, easier for other people to find their way)
  • Should we keep the Code somewhere, as a reference? ( We are using Version Control, but i find it is pretty hard to find old code in the Revision Jungle ... any tips for that? )
  • Do you have arguments for convincing the team / management / developers that wrote said code?
  • Reasons to not deprecate and then delete Code?

TL;DR: Delete unused code or leave it as it is? Discuss!

u

like image 334
Paul Weber Avatar asked Dec 31 '25 01:12

Paul Weber


2 Answers

If you are certain that the code is unused, definitely delete it. I assume you have a version control system, so if you ever need it again, you can still find the code back.

Deleting the unused code will make the project easier to maintain, and your team probably will end up saving time in the long run (nobody will re-read the code to try and understand what it was used for, nobody will end up changing said code thinking it may still be used...)

However, if your code contains a public API that is distributed, you will probably want to mark the classes/methods deprecated for some time before effectively deleting the code, so the callers have some time to adapt (or inform you of the issue).

like image 51
bug Avatar answered Jan 06 '26 07:01

bug


  • Would you remove the old Code, or hope that it may awake some time ... zombie - like

I'd definitely remove it. I hate having to work out if functions ever get called.

  • Do you think that it is worth the Effort to remove the Code (less work to find stuff in the clutter, better test coverage, easier for other people to find their way)

Yes, definitely worth the effort.

  • Should we keep the Code somewhere, as a reference?

Um, you are using version control softwarev, aren't you?

like image 37
unquiet mind Avatar answered Jan 06 '26 06:01

unquiet mind



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!