Scrum Agile Project Management

Resources for Code and Database Refactoring

Martin Fowler defined refactoring as a ” disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior”. In the days of Agile development where code is delivered after one or two-week cycles, you start quickly to deal with “legacy” code, what was known as “maintenance” for projects that had longer delivery time frames.

To limit your technical debt, code refactoring should be an ongoing activity in Agile teams. Even if refactoring is mostly linked to code, the term is also widely used for every restructuring effort: database definition code, testing scripts, software architecture or development process.

In the core principles and best practices of refactoring, you will have to keep behavior unchanged as you verify with tests before and after refactoring. You work in small, incremental steps: make tiny, reversible changes and run tests frequently. It is important to automate tests and CI. A solid test suite and continuous integration are prerequisites to code refactoring. In addition, you need to improve readability of your code first with prefer clear names, single-responsibility functions, and consistent style. Finally, you need to refactor for intent: you have to change the structure so the code expresses why it exists, not just how.

I am sure to forget some precious resources in this overview, so do not hesitate to add some pointer in the comments (no commercial tools, thank you). Some of these resources are language specific (Java, Ruby, .Net, Python, PHP and even Fortran) but you will also find global perspectives that are above the code level.

Resources for Code Refactoring and Limit Technical Debt

Websites

Wikipedia refactoring page
Martin Fowler’s homepage about refactoring
Wiki Pages About Refactoring
Refactoring Databases – Evolutionary Database Design
Refactoring To Patterns Catalog
Refactoring.Guru

Articles

A Developers’ Guide to Refactoring Databases
Refactoring Large Software Systems
Refactoring Automated Functional Test Scripts with iTest2
Easy Database Refactoring
Smells to Refactorings Cheatsheet
Refactoring Java Code
Refactoring Rails: Strategies to Refactor Models

Books

Refactoring: Improving the Design of Existing Code by Martin Fowler, Kent Beck, John Brant and William Opdyke
Refactoring to Patterns by Joshua Kerievsky
Refactoring: Ruby Edition Jay Fields by Jay Fields, Shane Harvie, Martin Fowler, Kent Beck
Refactoring Databases: Evolutionary Database Design by Scott J Ambler and Pramodkumar J. Sadalage
Professional Refactoring in C# & ASP.NET by Danijel Arsenovski
xUnit Test Patterns: Refactoring Test Code by Gerard Meszaros
Refactoring in Large Software Projects: Performing Complex Restructurings Successfully by Martin Lippert and Stephen Roock

Open Source Refactoring Tools

The OpenRewrite is an open-source automated refactoring ecosystem for source code, enabling developers to effectively eliminate technical debt within their repositories.
Wrangler is an interactive refactoring tool for Erlang
Scientist! is an open source Ruby library for carefully refactoring critical paths
Jedi is an autocompletion, static analysis and refactoring library for Python
jsinspect is an open source tool that detect copy-pasted and structurally similar JavaScript code.

Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.