Skip to content
DevMeme
5113 of 7590
Refactoring Post #5597 · source on Telegram

The Senior Developer's Mantra: The Best Refactor is Deletion

Description

A screenshot of a tweet from Greg Brockman, co-founder of OpenAI, with the Twitter handle @gdb. The tweet, displayed in white text on a black background, contains the concise and profound statement: 'the best refactor is to delete the code'. Below the text, engagement metrics show significant interaction, indicating the sentiment resonates widely within the tech community. This piece of advice is considered a core tenet of senior-level software engineering. It posits that the most effective way to improve code quality, reduce complexity, and eliminate technical debt is not to restructure or rewrite code, but to remove it entirely. This implies that the feature the code supports may be unnecessary, over-engineered, or solved by a simpler, existing solution. It's a powerful statement about prioritizing simplicity and challenging the assumption that more code equals more value

Comments

11
Anonymous ★ Top Pick The junior engineer proudly announces they've added 500 lines of code. The senior engineer proudly announces they've deleted 1000. The principal engineer has prevented the meeting that would have generated the feature request in the first place
  1. Anonymous ★ Top Pick

    The junior engineer proudly announces they've added 500 lines of code. The senior engineer proudly announces they've deleted 1000. The principal engineer has prevented the meeting that would have generated the feature request in the first place

  2. Anonymous

    Architects know the fastest way to hit five-nines is to ship /dev/null to prod

  3. Anonymous

    After 20 years in tech, you realize the most valuable PR is the one with the most red lines - because the only code that never breaks is the code that doesn't exist. Somewhere, a principal engineer is nodding while deleting their entire microservices architecture

  4. Anonymous

    Ah yes, the 10x engineer's secret weapon: achieving negative lines of code. While junior devs measure productivity by commits added, seasoned architects know the real art is in what you *don't* build. Every line deleted is one less line to debug at 3 AM, one less dependency to update when the next CVE drops, and one less thing to explain during the architecture review. It's the Marie Kondo approach to software engineering - if that code doesn't spark joy (or revenue), thank it for its service and `git rm` it into oblivion. The best part? Your code coverage percentage goes up automatically

  5. Anonymous

    Deleting code is the only refactor guaranteed to reduce cyclomatic complexity without a single regression

  6. Anonymous

    My highest-ROI refactor was a -3,842 LOC PR - on-call got quieter, CVEs vanished, and the architecture diagram finally fit on one slide

  7. Anonymous

    Best PR I ever shipped was literally 'git rm -r'; reviewers loved the reduced cognitive load and attack surface, and the only regression was the LOC dashboard

  8. @megapro17 2y

    Finally good clean code advices

  9. @moyuefeng 2y

    clean and clear

  10. @mpolovnev 2y

    When I delete my code, Sonar says there are fewer bugs and code smells :)

    1. @CcxCZ 2y

      Every program has at least one bug and can be shortened by at least one instruction -- from which, by induction, one can deduce that every program can be reduced to one instruction which doesn't work.

Use J and K for navigation