It’s useful to have a vocabulary for talking about refactoring. It will help you to communicate when doing strong-style pairing or mob programming. Code smells is perhaps a less-known concept than refactoring and knowing these names will also help you to communicate about code. In this learning hour we’ll talk about what a code smell is and learn the names of a few of them.
What kind of characteristics of the code prompt you to for example:
Note down your ideas and share them with the group when the facilitator asks.
Explain Martin Fowler’s description of code smells. Note that the names of these are in his book but not on his website. For a list of some common code smell names seen wikipedia
Have them review all 3 of the Tennis implementations in The Tennis Refactoring Kata, and note down any code smells they find. The idea is just to read the code at this point, not change it.
When they’ve looked at the code, write up on a whiteboard the names of smells that they have found. Tell them the ‘official’ name (from Fowler’s book) if they don’t know it.
Pick one of the smells and look up the corresponding refactoring. Depending on the skill of the group, either demo the refactoring or ask them to do it. Repeat with more smells and refactorings.
How would you define ‘code smell’? Write a definition on a sticky note and take it with you to put next to your screen.