Refactoring от Thomas Sundberg

Докладчик Thomas Sundberg

Refactoring code is an important task that normally needs to be done to keep your code tidy, easy to read and easy to understand. Clean and understandable code will allow you to accommodate new business requirements without too much problems.

There are two types of refactoring, the kitchen type and the garage type. 

The kitchen type of refactoring is the one you perform everyday without planning for it. It is a natural part of your development cycle. You write your test, you write your production code and you refactor a little. Just like cleaning the kitchen after preparing a meal. This is done without any planning or preparation, you just do it. 

The garage type of refactoring is when you start refactoring a large part of your code and is not something you do a little bit at a time. A large refactoring may need some planning and preparation so you are able to finish your refactoring without ending up with a mess of broken code. You want to visualize your goals and you want to make sure that you always stay on track and create value instead of getting lost among the dependencies. 

One good way to plan a garage type refactoring is to start off with creating a dependency graph with all tasks that needs to be fixed. Then use the leaves in the graph as starting points for the refactoring. Remove each leaf in small refactoring steps and commit to the repository. The result will be a large refactoring done in many small steps. Each step is a small risk for the project. In this session I will show you what to refactor. I will also show you how you can use a structured method as a tool to plan and perform a large refactoring.


Refactoring, Continuous improvement, Test Driven Development (TDD)

Обновлен 28 янв., 09:16