Agile Mumbai 2008

 
 
Refactoring - Proposal  
 

Refactoring

The proposal is for a Refactoring Workshop to introduce the attendees to the practice of refactoring by way of hands-on coding and critique of coding approaches, each code + critique cycle taking 25 minutes or less. By the end of the workshop, it is hoped that the attendees will be able to appreciate the practical benefits of applying refactorings in their day-to-day work.

Content

  1. Refactoring overview
    1. What is refactoring
    2. Why refactoring
    3. What are the preconditions
  2. Code smells
    1. Comments
    2. Duplicated Code
    3. Long method
    4. Feature Envy
    5. Message chains
  3. Refactorings
    1. Rename
    2. Extract Method
    3. Extract Class
    4. Pull Up Field/Method
    5. Move Method
    6. Hide Delegate
  4. Composing large refactorings from smaller ones

Format of the Workshop

Apart from an introductory talk and a summary at the end, the workshop will be conducted as follows: To start off with, attendees (who may be asked to pair) will be given sample code for a small problem. Attendees will be requested to factor in a new requirement related to the previous problem. They will be given about 15 mins to implement their solution by modifying existing code. During this the trainers will walk around and silently observe the attendees' work. At the end of 15 mins, one of the attendee pairs will be asked to project their solution. The trainers will trigger and guide a discussion around the approach while suggesting refactorings that the pair will implement alongside. Once the refactorings are done, everyone will sync up their code using version control, and the cycle will be repeated.

Target Audience

People who use object oriented programming. This includes:
  1. Developers who are
    1. Maintaining or adding features to existing code bases
    2. Working in teams with collective code ownerships
  2. QAs writing/maintaining automated tests
  3. Designers/Architects doing incremental design

Value

At the end of 3 hours, it is expected that the attendees will be able to
  1. Explain why people refactor:
    1. Reading and understanding code
    2. To increase code maintainability/readability
    3. Fitting in changing requirements
  2. Apply specific refactorings while recognizing corresponding smells and consequences
    1. Rename: Non-communicative method names: Better readability
    2. Extract Method: Duplication: Higher abstraction, less duplication, more readability
    3. Pull up method/member: Duplication
  3. Compose large refactoring from a series of smaller refactorings
    1. Create template method or create strategy out of change signature, extract method and pull up/move method
  4. Watch out for refactoring 'gotcha's
    1. Changing data types during refactoring

Agenda

  1. 15 mins - Introduction: refactoring overview
  2. 125 mins - Code + Critique (25-min cycles): applying specific refactorings to accommodate changes
  3. 15 mins - Close: summarizing learnings, references, tool support

Trainer Profile

Aman King has over 2 years of industry experience but has been programming for many years. He was introduced to Agile over a year back, and has since been sharing his learnings in talks and blogs. He loves programming in Ruby and has conducted training around Ruby and Rails. Refactoring is something that he practices daily on his project work as a ThoughtWorker.

Chirag Doshi is a developer at ThoughtWorks. He has been an Extreme Programming (XP) fanatic since the past 3 years. He has been part of teams which delivered some very complex projects at ThoughtWorks. He attributes a lot of these successes to the XP principles and practices.

 
 
 
   
 
 
   
   
 
 
   
   
   
   
   

2005- Copyright © Agile Software Community of India
Website designed and hosted by Xnsio