July 2012 – Refactoring Session

Courtesy of the daily WTF


Date: Thursday 26th July 2012

Time: 7:30pm start

Venue: The Stafford Ale House
Location: Google Maps

Refactoring Session

During July’s meeting of Agile Staffs the plan is to have a refactoring session.  The purpose of the session is to get everyone to take part in an exercise of refactoring some simple code as a means of encouraging discussion about the process and the many ways that we can go about it.

Everyone participating in the exercise will be starting from the same basic code base and may refactor it in any way that they please to improve the code.  There are some simple acceptance tests that verify the code is doing what it should.  Aside from that everyone may work on the code however they see fit.  The exception to this rule being the acceptance tests cannot be changed as they govern that everyone’s source code will still solve the same basic problem.

We have a couple of options for how the evening could be run, and I would welcome feedback as to what you think you would prefer.

Initially, everyone pairs off with a programming partner and begins to refactor the sample code, refactoring goes on for approx. 40 minutes, after which we all break for a discussion, where each pair takes a turn to describe how they have refactored the code.

From there we have a couple of options, assuming there is some time left.  We could either; continue with the refactoring from where we left off or, reset the virtual machines back to their initial state, select new programming partners and start the exercise again (as per the code retreat process).

The Environment

To make sure that everyone is using the same environment and starting from the same point, an Ubuntu Virtual Box Instance is available that contains an install of IntelliJ, Git and the proposed exercise ready to go.  Each participant will need a copy of Virtual Box and the Virtual Machine that is available via Dropbox.  The download is almost 7Gigs in size, so I will also bring copies of both the Virtual Box installs and the VM on the night but the process would be sped up greatly if everyone was prepared beforehand.

It is possible to download the image, spin it up in Virtual box to the login screen for Ubuntu to make sure it works and I would recommend that people do this so that on the night they can simply get the password and crack on.

Links to downloads:

Virtual Box:

https://www.virtualbox.org/wiki/Downloads

The Ubuntu Image and Instructions:

https://www.dropbox.com/sh/yn1d7l1z3uk366u/JJBB0VRx_l

The Exercise

I am going to keep the exercise itself as my little secret for now.  I was going to make something up, however a quick Google search turned up an exercise for which, the initial source, an ideal final source and acceptance tests are available so I have opted to go with this instead.  Firstly, because it was there and saved me from having to worry too much about providing something that was too complicated or too simple for two 40 minute sessions and secondly because it has an ideal solution that I will hold back until much later in the session as a kind of yard stick to see how we all did.

Anyway, the aim of the session is to have a little fun, have a lot of discussion and hopefully learn some stuff as we go.

In the meantime, if anyone has any issues getting setup or queries about the session, please email me at Robert@stothard.me.uk and I will try my best to help out.

 

In the meantime, below are some further links for information about in case anyone would like to brush up beforehand.

http://www.infoq.com/presentations/Stop-Refactoring

http://lostechies.com/seanchambers/2009/10/20/31-days-of-refactoring-ebook/

http://books.google.co.uk/books/about/Refactoring_Workbook.html

 

See you there

 

Bob

Leave a Reply

Your email address will not be published. Required fields are marked *