Tag Archives: Coderetreat

Legacy Coderetreat: Part 4 – Fix bugs on Legacy Code

Fix bugs on legacy code

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

When we need to fix bugs on legacy code, we first need to understand if the described behaviour is in fact a bug or not. For that we can write some characterization tests in order to understand what the system really does. The simplest form of characterization test is a system test. A couple of ideas to start writing the characterization tests are to use the generic approach Part 2 – From Nothing to System Tests and Part 3 – Golden Master. We can generate system tests considering that the System Under Test (SUT) is a black box. You can find more details about how to do that in the blog posts and code casts about the above techniques. But in order to fix bugs on legacy code we need to dive more into the code base. We need to write tests on a smaller scope and we often need to refactor in order to make room for the code changes. Let’s see a technique of fixing a bug in legacy code.

Fix bugs on legacy code

Fix bugs on legacy code

Read More →

Legacy Coderetreat: Episode 2 – Golden Master Code Cast

Golden Master – code cast

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.

Code Cast

This is a code cast in Java where I start generating system test with the Golden Master technique. Please read more details about this technique in the Part 3 – Golden Master blog post. Have fun!

 

 

 

Legacy Coderetreat: Part 3 – Golden Master

Golden Master on legacy code

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 you start dealing with an existing software system you need to have a basic safety net. This basic safety net will make sure that whenever you change big things in the code, the changes will not affect the existing functionality. You can read more about this concept in the generic session Part 2 – From Nothing to System Tests.

As mentioned in the above entry, we want to start with some basic safety feature that will let us test the code in a generic way, focusing only on inputs and on outputs and without changing the production code. So we will treat the system as a black box (we do not care about the internal behaviour of the system, we care just about the whole system inputs and outputs) and we will test only the outputs for given inputs.

The Golden Master technique is very useful when a clear input and output is easy to obtain on the system level. There are some cases where the Golden Master technique can be applied with difficulty or where it cannot be applied at all. We will discuss these situations further as well.

golden-master-beatles-hey-jude-lp

In audio mastering, a golden master is a model disk used as a reference to create disks in the old vinyl industry. This disk was cut in metal and it would contain the sound transferred from a microphone (see here more details). In the software world we took this name and we started using it for a fixed reference of a system output, paired with a system input.

Read More →

Legacy Coderetreat: Episode 1 – From Nothing to System Tests Code Cast

From Nothing to System Tests – code cast

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.

Code Cast

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!

 

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 →

Taking Baby Steps

Taking Baby Steps

I wrote a post on the history of Taking Baby Steps, you can read it here.

Now I would like to tell you more about the workshop and the technique itself. While coding, for me it is very important to be focused on one idea. Why? Because this is how programmer mistakes appear in the code; some people tell them bugs. The other thing I am interested in is to have an undo button for every change. This is why I want to commit every 1-2 minutes.

The rules are the following:

Steps

  1. Setup source control repository.

  2. Setup a timer for 2 minutes interval when you start.

  3. Write exactly one test

    1. If the timer rings and the test is red then revert and start over.

    2. If the test is green before timer rings then commit.

  4. Restart timer (no discussions in between timers)

  5. Refactor

    1. If the timer rings and the refactoring is not complete then revert and start over.

    2. If the refactoring is complete before the timer rings then commit.

  6. Restart the timer (no discussions in between timers)

  7. Go to 3.

  8. When session time is up delete the code.

Read More →

Kudos for the Global Day of Coderetreat 2012

Global Day of Coderetreat 2012

As last year I helped the coderetreat first-time facilitators to jump-in and organize their first coderetreat. I had some training sessions on Google Hangout during which I talked with a lot of passionate professionals from all over the world. Together with me Jim Hurne had done the same effort to spread his knowledge about the way he facilitates a coderetreat.

Jim has done a lot of work for the Global Day, he added the sessions on the coderetreat.org website created, the hangouts for all the registered attendees for each session, and a lot of other very useful things. He was full of energy and I want to thank him for all that effort, I don’t think the Global Day would have been that successful without his sustained effort.

I chose to go to Cluj-Napoca to facilitate the coderetreat on the Global Day. I had talked with the Cloud Troopers company about hosting a community event, and this was the time. They were kind enough to sponsor also the lunch. Out host was Georgiana Gligor, and she was very keen to see what a coderetreat is all about.

Read More →

Balkan Coderetreat, the first edition in Sofia

Balkan Coderetreat in Sofia

A couple of months ago I contacted Stefan Kanev to ask him if I could attend a coderetreat in Sofia. My main concern was not to bother all the attendees to speak English just because of me. What happened was that instead of attending a coderetreat I ended up facilitating a coderetreat in Sofia, and a rather special one.

Then I started chatting with Stefan and we ended up with the concept of Balkan Coderetreat. We want to create a type of event that will be organized in different countries in the Balkans. Why? Because there are not enough events for programmers around here. And one more reason: people from different countries and cultures would meet and share their knowledge and ideas. This idea is in the spirit of the ALE Network which I support as much as I can by being a bumble-bee, cross-pollinating ideas in the local European communities of Software Development. I would like to see this event happening in one of the Balkan countries each 2-3 months, organized each time by someone else. This would be in the spirit of a community of professionals that care about what they do and about sharing and learning, cross-language, cross-cultural and cross-border. I intend to support this event being organized again in a different country sometime in January.

Read More →

Coderetreat Turku, Finland

Coderetreat Turku, Finland

On 20 November Aki Salmi gave me the the opportunity to meet a wonderful group of passionate programmers in Turku, Finland. My friend and dynamic facilitator Erik Talboom was supposed to be there with us, but he could not make it this time. So I was on my own to facilitate a coderetreat in a country and a city I have never seen before.

The first surprise of the morning: almost everyone was at the venue at 8:45 when I arrived. “They must be eager to code”, I said to myself. But we waited a bit to make sure that everyone will arrive in time for the intro. And I took the time to enjoy the unusual cubical separators of the venue: hay stacks 🙂

Coderetreat Turku

Read More →