Thursday, June 10, 2010

Refactoring Workshop


Introduction

One of the challenges as a leader is how to make members of a development team understand the value of agile practices. In my effort to do that I tried something I start calling the Refactoring Workshop.

What is that ?

The goal of this Workshop is to practice Refactoring in a group session fashion using a projector and a computer the team can share.

During practice, the goal is to work one hour per week, and to do as much Code Refactoring as possible of something a team member developed through the last week.

The sole use of the team's code has some important benefits:

* less time to understand the intention of the code
* the team can act as reviewers and give instant feedback to the author
* being able to see how Refactoring affects your own code is key to understand  faster and better its value
* and the most important: the Refactored Code must be used after the session

You will need to count with a senior level developer in the session who is familiar with concepts as Refactoring, TDD and Clean Code. Him should guide the team to find the path if they get stuck and facilitate the session.

Workshop Agenda

The session should take no more than an hour for two main reasons:
  - longer sessions generates longer discussions. The team will understand after a few sessions (if not in the first one) that they need to focus to get some job done
  - easier to get that time frame for training or the team can just use the lunch hour from one day of the week. If the facilitator brings the food even better ;)

So far, the Workshop agenda that worked for me is this:

* Last Session Overview: 5 min

Talk about the Code Refactored the last session and discuss its impact on new development and the overall project. Don't just forget about the code already done, get back quickly to ask questions like:

- "How was the impact on maintainability ?"
- "Does it make new development easier ?"
- "How was the users reception of the refactored code ?"

* Code to be Refactored Presentation: 10 min

Open the Code to be Refactored during the current session and pass the keyboard over the author who must give information enough to the team to understand the domain, scode and requirements.

* Code Refactoring: 40 min

During this window the team must do a refactoring applying good programming practices.

As facilitator, make sure to coach the team to learn all they need to do a good refactoring but must of all allow the team to teach themselves if they can. It will be easier for them if a team mate share the knowledge and also it will increase collaboration.

* Session Review: 5 min

Leave time at the end to discuss what was learned during the session and the pros of the worked code against the original draft.

Final Thoughts

After two or three sessions most of the participants unfamiliar with good programming practices should understand their value and start applying them on day to day work.

No comments:

Post a Comment