Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
As the size of your project grows, some blocks of code become irrelevant. How can you find and delete them? And how can you be sure code is actually dead? This talk will review a few techniques I learned from removing 50,000 lines of Ruby code at work. We will see how git can help, with commands like blame, log --follow, and bisect. We will talk about static analysis, and running code coverage in development. We will explain how Ruby meta-programming can conflict with the "Find in Project" approach. We will show how to be nice to reviewers when submitting Pull Requests that delete code.
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
The video titled "The Art of Deleting Code" features Claudio Baccigalupo discussing the process and techniques involved in identifying and removing dead code from a Ruby codebase. As projects grow, certain code blocks become irrelevant, and this presentation aims to help developers find and delete such code effectively. Claudio shares his experience of removing 50,000 lines of Ruby code from a large codebase, showcasing methodologies that can aid developers in their own projects. ### Key Points Discussed: - **Mindset towards unused code**: Claudio begins with a personal reflection on his inclination to maintain clean, unused spaces in both his physical and coding environments, emphasizing the challenge of handling a large codebase effectively. - **Process for code deletion**: He details a three-step process for deleting code: - **Finding code to delete**: The first step involves recognizing code that may no longer be necessary by examining it. - **Confirming code is unused**: He discusses using tools like Git to investigate the history of the code—utilizing commands such as `git blame`, `git log`, and `git bisect` to understand how and when the code was used. - **Communication with team members**: It's essential to articulate the rationale behind removing code, especially in Pull Requests (PRs), so that team members can review them without confusion. - **Example of deletion process**: Claudio narrates a case where he investigates an option called `header icon`, discovering it's no longer utilized by checking its history in Git. He emphasizes the importance of writing a well-structured commit message that links to the history of the code for reviewers' convenience. - **Best practices for code removal**: He advises on keeping commits small and manageable and mentions the Git `stash` command for pausing current work to handle code deletions effectively. - **Advanced techniques**: Claudio also presents two advanced strategies: - Using **code coverage tools** to identify which sections of the code have not been executed, suggesting places where dead code may reside. - Utilizing **git bisect** to efficiently find the commit that caused the code to stop being used, rather than manually searching through many commits. ### Conclusion: Claudio concludes with a call to action for developers to take ownership of their codebases by removing unnecessary code, likening it to cleaning up trash on a beach. His talk encourages attendees to submit proposals at events, suggesting that sharing knowledge is valuable within the programming community. By embracing a clean code philosophy, developers can contribute to maintaining more manageable and efficient codebases.
Suggest modifications
Cancel