Monthly Archives: April 2014

You are browsing the site archives by month.

Legacy Coderetreat: Episode 1 – From Nothing to System Tests Codecast

From Nothing to System Tests – Codecast

Blog post series

This blog post is part of a series about legacy coderetreat and legacy code techniques you can apply during your work. Please click to see more sessions about legacy code.

Codecast

Before starting to change any legacy system you need to know you will not introduce any defects when changing the code. So one way would be to stay on the safe side and start writing some automated tests. These tests can be Golden Master type of tests, they can be Characterization Tests, or anything else that might give you this certainty of correct changes in a later stage.

This is a code cast in Java where I start covering with tests a simple code base. Please read the explanation of this technique in the Part 2 – From Nothing to System Tests blog post. Have fun!

 

This session has some prerequisites:

  • Good knowledge of unit testing and test doubles, especially mocks, stubs and fakes.
  • Very good knowledge of the programming language you use. You often need to use some hacks that will allow you not to change the existing code and be able to test it.
  • Open mind to new, sometimes mind-blowing, techniques and concepts.

Further it is very important to have good knowledge about software design, especially techniques of decoupling the existing code. It would be a good thing that any attendee would know about the SOLID Principles and have basic knowledge about Design Patterns.

Legacy Coderetreat: Part 2 – From Nothing to System Tests

From Nothing to System Tests

Blog post series

This blog post is part of a series about legacy coderetreat and legacy code techniques you can apply during your work. Please click to see more sessions about legacy code.

Purpose

Whenever I need to change an existing system I need a safety net. These system tests knit a coarse safety net, very good if you want to have the safety of changing code later without introducing defects.

This is the first thing I usually do when I start working with a system that:

  • does not have any automated tests
  • is totally unknown to me

This safety net will be used during the next phases when the code will be refactored and cleaned-up, before being modified. Now let’s see a bit about the concept of this session.

from-nothing-to-system-tests

From Nothing to System Tests

Read More →

Legacy Coderetreat: Part 1 – Introduction

Legacy Coderetreat

Blog post series

This blog post is part of a series about legacy coderetreat and legacy code techniques you can apply during your work. Please click to see more sessions about legacy code.

A bit of history

On 26 November 2011 I had the honour of being an attendee at the second ever Legacy Coderetreat, which was supposed to be the first one in the world. But my friend Johan Martinsson from Grenoble beat Erik and me to it. Anyway I was part of the second ever Legacy Coderetreat in the world, facilitated by JB Rainsberger. JB had come with this concept of using the Coderetreat format, but for legacy code.

At the beginning of the day he presented us the problem, like in any other coderetreat. The problem was an ugly trivia game and you can find the sources here. At that time the code base was translated, from Java, only in a couple of other languages. Now you can find almost any language you want, thanks to the worldwide community of passionate developers who translated the code base.

JB facilitated the event like you could find in here, with a lot of details. But in short we would start with a free session, then follow with Golden Masters, continue with Subclass to Test, Replace Inheritance with Delegation and then Pure Functions. After each iteration we deleted the code like in any other coderetreat and swapped the pairs.

I liked a lot the fact that JB started this idea, because I am a big lover of working with legacy code. And this Legacy Coderetreat is such a good way to practice. But I had some other ideas on how to make it different.

legacy-coderetreat

Legacy Coderetreat

Read More →

A community event: Bring your own code

Bring your own code

Last month I started a new community event idea. It is called “Bring your own code”, and I “stole” it from what Antoine Vernois is doing in the Toulouse Software Craftsmanship Community. You can find here the event page. Tomorrow we will have the second edition that you can find here. Let’s go a bit into the mechanics of this event type.

Why

  • You have a project and you want a second opinion.
  • Your code needs improvements and you do not know where to start from.
  • You just like to show some awesome code and give it as an example.
Bring Your Own Code

Bring Your Own Code

Read More →