Does Programming equal Refactoring?

1 minute read

This infographics presents how TCR increases the share of refactoring in TDD. But Refactoring is already most of our daily work! We’d better learn it seriously.

Drawing of the TDD Red-Green-Refactor loop along the TCR loop. In the TCR loop, Red is reduced to a dot, green is small, but Refactor takes 95% of the circle.
By Philippe Bourgau, under CC BY-SA 4.0, high resolution image

TCR stands for test && commit || revert. It started as an experiment by Kent Beck. It’s a script that automatically commits or reverts whether the tests pass or fail.

TCR is the ‘natural’ evolution of TDD. Kent Beck has been arguing for a long time to

Make the change easy, then make the change

When you follow this mantra, even without TCR, most of your work becomes refactoring.

Why refactoring?

Programmers, especially juniors, often shun refactoring. We are afraid of Legacy code. We tend to look for greenfield projects, to avoid refactoring other people’s code.

Done well, I actually find Refactoring pretty rewarding. I know I’m making the lives of my teammates easier every time I improve a line of code. When all the team does it, it creates a sustainable pace, which dribbles down on all aspects of our lives.

Start now!

We can learn TDD refactoring techniques, like any skill. Reading a few books and starting a coding dojo will get you on good tracks.

During this summer, I’ve posted a few similar infographics. This was the last one, the next post is a longer read about maintaining a TO DO list or a Mind Map for programming.

Comments