DEV Community

Pawel Kadluczka
Pawel Kadluczka

Posted on • Updated on

Delete code to accelerate your dev career

While you were writing some new shiny features today, the following happened:

  • Someone accidentally disabled a feature flag gating the most important product feature that shipped years ago
  • Someone spent a day fixing tests not realizing the code being tested is only executed by these tests
  • Someone missed a deadline because the build system was building long forgotten libraries instead of the code they committed to ship

The common denominator for all these cases - dead code.

Aggressively cleaning code that is no longer needed or used can, and will make your team more effective because it reduces the overall complexity of the codebase. This, in turn, unlocks a lot of benefits:

  • bugs and mistakes are easier to avoid
  • new features can be delivered faster
  • less time is spent on (unneeded) maintenance

Deprecating rarely used features takes it to the next level.

Try it, and you may turn your team into a team of the proverbial “10x engineers”.


💙 If you liked this article...

I publish a weekly newsletter for software engineers who want to grow their careers. I share mistakes I’ve made and lessons I’ve learned over the past 20 years as a software engineer.

Sign up here to get my articles delivered to your inbox.

https://www.growingdev.net/

Top comments (4)

Collapse
 
nombrekeff profile image
Keff

Yess!! This is great advice. I also notice that it gives me a dopamine hit when removing dead code. Similarly to how throwing away old stuff you have around the house is quite satisfying 😄

Collapse
 
artxe2 profile image
Yeom suyun

Humans are naturally inclined to favor change.
I feel a sense of satisfaction every time I run pnpm -r up --latest when I open a project.

Collapse
 
asimpson82 profile image
Anthony

Absolutely spot on! Dead code is like clutter in the attic – it might not seem like a problem until you need to find something important. Your experience highlights the real impact of neglecting dead code, and I couldn't agree more with the importance of aggressively cleaning it up.

Cleaning up dead code has several benefits:

Reduced Complexity: Dead code adds unnecessary complexity, making the codebase harder to understand. By removing it, you streamline your code and make it more maintainable.

Bug Prevention: Unused code can contain latent bugs or vulnerabilities. Cleaning it up reduces the risk of inadvertently introducing bugs and makes it easier to spot issues.

Faster Feature Delivery: A leaner codebase means developers spend less time navigating through irrelevant code. This not only speeds up development but also allows for quicker onboarding of new team members.

Efficient Testing: Removing dead code ensures that your tests are focused on relevant functionality. In your case, fixing tests for code that's not executed is a classic example of how dead code can lead to wasted effort.

Improved Build Performance: Unnecessary libraries and dependencies can slow down the build process. By removing dead code, you optimize build times and make the development workflow smoother.

Deprecating rarely used features is the icing on the cake:

Enhanced Focus: It allows the team to concentrate on the core, high-impact features, rather than spreading efforts thin across rarely used functionalities.

Simplified Maintenance: Less code means less to maintain. Your team can spend more time on tasks that directly contribute to the product's success.

Clearer Roadmap: By deprecating rarely used features, you communicate a clear roadmap to your team and stakeholders, aligning everyone with the product's strategic direction.

In the end, a team that actively cleans up dead code and deprecates rarely used features is like a well-oiled machine – efficient, agile, and focused. Kudos for emphasizing the importance of this often overlooked aspect of software development! 💻🛠️

Collapse
 
iamspathan profile image
Sohail Pathan • Edited

Someone mentioned this. I've personally experienced this when I discovered that many libraries used by existing developers are not backward compatible. I had to find alternative solutions, or a common option is to swap them out with APIs.
This made me realize that I can concentrate on creating specific functions without needing to be concerned about the inner workings of other components.

Now, I also advocate for using more APIs at ApyHub.