Could someone explain the pros of deleting (or keeping) unused code?

前端 未结 11 981
温柔的废话
温柔的废话 2020-12-12 11:01

I have heard many times that unused code must be deleted from the project. However it is not clear for me \"why?\".

My points for not deleting that are:

11条回答
  •  一生所求
    2020-12-12 11:48

    First of all you should always use a source control tool to manage your projects and hence removing unused code is a good practice as you can always go back using source control to get the removed code. For me the reason to remove unused code is that only the person who know the code is unused knows about it, someone else in the team will come across that code and try to figure out what it does and how it fits in the whole application and will feel disappointed after so much effort that the code is not used at all :)

提交回复
热议问题