Approval Tests, TCR, and Menders

Struggling with Legacy Code and not enough time to clean it up?
⛑️️ My First Aid Kit can help you rescue any codebase quickly and safely!

On September 9, 2020, I co-organized the 3rd edition of The Legacy of SoCraTes with my partner in crime Adrian Bolboacă.

It’s a half-a-day remote conference where 5 speakers share their tips to deal with Legacy Code.

The Legacy of SoCraTes by Nicolas Carlo and Adrian Bolboacă

This edition had an accent on bringing existing code under tests. We talked about Approval Testing a lot. I have a dedicated page for that. These talks are a great opportunity to learn more and see it in action.

Without further ado, let me tell you how each talk can help you deal with your existing codebase.

A deep dive into the Gilded Rose

Barney Dellar kick-started this conference by demonstrating the Approval Testing technique, on the Gilded Rose refactoring kata, in C++.

I like this talk because it shows the technique in action, on concrete code.

Also, Gilded Rose is an exercise I recommend doing if you want to get better at refactoring existing code.

Watch him get the code under test in no-time:

Approval Testing

Approval Testing, again?!

Well, this was intentional. Emily Bache follow-up on Barney’s talk to go further with the techniques.

She has been using this technique in lots of situations for many years. It’s especially useful when working with legacy code. But there are common pitfalls to avoid and best practice to learn.

Oh and if you don’t know Emily, she’s the expert in coding exercises. Most of the refactoring katas I would recommend can be found in her GitHub, in many different languages:

Watch her talk to see how she compares unit tests and approval tests methodologies:

Did you noticed she uses a similar definition of Legacy code of mine:

Valuable code that works, developers find it difficult and we need to change it safely.

7 Techniques to understand Legacy Code

This time, these techniques are not from me 😁

Jonathan Boccara is the author of The Legacy Code Programmer’s Toolbox. It’s one of the rare books that give you practical skills when you have to deal with Legacy code.

In this talk, Jonathan presents 7 techniques that can be handy:

  1. Know your I/O frameworks
  2. Find a stronghold
  3. Analyze call stacks
  4. Start reading from the outputs
  5. Count words (I wrote about this one in details)
  6. Filter on control flow
  7. Scan for the main action

See them in action in his talk:

TCR is your best friend against legacy

Test, Commit, or Revert (TCR) is a technique that was popularized by Kent Beck. You can think about it as a variant of TDD, pushing the programmer to do very small changes.

My friend Khaled Souf had the opportunity to actually use it on a Legacy rescue project. In this talk, he shares his experience and explains why it’s really efficient when you’re dealing with existing, untested code:

Makers vs Menders

Finally, I had the pleasure to host M. Scott Ford to talk about developers’ mindsets.

We’re all familiar with “makers”. But it takes a different state of mind to really enjoy mending code.

Scott presents 4 different traits:

  1. The rapid prototyper
  2. The feature builder
  3. The emergency responder
  4. The software remodeler

He goes into the details of what are the strengths and weaknesses of each, and in which case each is best suited.

I personally don’t like putting people inside boxes. We made that clear with Scott as we discussed how each of us can be in many boxes at the same time, or switch depending on the context.

This is a really inspiring talk I recommend you to watch if you feel alone, fighting with your codebase:

If you want to connect with other menders (like me!), I recommend you join the Legacy Code Rocks community. There is a Slack group and a weekly virtual meetup.

If you join there, come and say hi to me 👋

“These talks are really great, can we have more?”

Sure thing!

There’s no fixed schedule, but I like to organize this short conference every few months. I reach out to a few speakers to build an interesting agenda, then we set up the event.

Everything is FREE. Attending is the opportunity to directly ask questions to these speakers, from the comfort of your home.

If that’s something you’d like to hear about, subscribe to my newsletter below 👇

I publish my monthly tips on Legacy Code here. I also tell my subscribers in advance about the conference and the agenda, so they don’t miss out. Join them!

Nicolas Carlo

Written by Nicolas Carlo who lives and works in Montreal, Canada 🍁
He founded the Software Crafters Montreal community which cares about building maintainable softwares.

Similar articles that will help you…

Can AI help me write tests on legacy code?

People are using tools like ChatGPT to write tests on existing code… But how reliable is this? Let's find out!

7 advice to help you inherit a legacy codebase

My recap of the most common and useful advice one can give to tackle Legacy codebases.

Improve your refactoring and testing skills with the Expense Report kata

Watch Gregor Riegler refactor code with this coding exercise. Learn useful techniques from it.

3 must-watch talks on Legacy Code

I have hosted more than 37 speakers to talk about Legacy Code tips and tricks. Here is my top 3 of the talks you should probably watch!

← Find more tips to work with Legacy Code