The Brutal Refactoring Game (2013)
Upcoming SlideShare
Loading in...5
×
 

Like this? Share it with your network

Share

The Brutal Refactoring Game (2013)

on

  • 994 views

 

Statistics

Views

Total Views
994
Views on SlideShare
994
Embed Views
0

Actions

Likes
1
Downloads
8
Comments
0

0 Embeds 0

No embeds

Accessibility

Upload Details

Uploaded via as Adobe PDF

Usage Rights

CC Attribution License

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

The Brutal Refactoring Game (2013) Presentation Transcript

  • 1. The Brutal Refactoring Game #CodeCopTour, Sept. 2013 Peter Kofler, ‘Code Cop’ @codecopkofler www.code-cop.org Copyright Peter Kofler, licensed under CC-BY.
  • 2. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Peter Kofler • Ph.D. (Appl. Math.) • Software Developer for 14 years • “fanatic about code quality” • Pair Programming #CodeCopTour
  • 3. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Workshop Structure ● Introduction 15' ● 3 Sessions a 30' ● Retrospective 15'
  • 4. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Coding Dojo Mindset Safe place outside work ● Mistakes are ok ● ● We are here to learn Need to slow down ● Focus on doing it right ●
  • 5. Don't Focus on Getting it Done. F0cus on Doing It Perfectly.
  • 6. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Code Smells
  • 7. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY List of Code Smells 1. Lack of tests 9. Feature envy 2. Name not from domain 10. Method too long (> 6 lines) 3. Name not expressing intent 11. Too many parameters (> 3) 4. Unnecessary if 12. Test – not unitary 5. Unnecessary else 13. Test – setup too complex 6. Duplication of constant 14. Test – unclear Act 7. Method does more than one thing 15. Test - more than one assert 8. Primitive obsession 17. Test – too many paths 16. Test – no assert
  • 8. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Benevolent Dictator ● I want the cleanest code possible! ● Any smell must be removed immediately ● I will stop you whenever I spot a smell ● Adding functionality is forbidden until you refactor the smell away.
  • 9. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Tic-Tac-Toe ● http://en.wikipedia.org/wiki/Tic-tac-toe ● Board 3x3 ● X plays first, O plays second ● Check if/who is winner
  • 10. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY What Exactly Will We Do? 1. Group into pairs 2. Write code (25') ● ● Write tests Refactor brutally 3. Discuss (5') ● Disagreement Cards
  • 11. →Practice
  • 12. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Closing Circle ● What did you learn today? ● What surprised you today? ● What will you do differently in the future?
  • 13. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY Peter Kofler @codecopkofler www.code-cop.org Game by Adrian Bolboaca @adibolb http://blog.adrianbolboaca.ro/2013/07/brutal-refactoring-game/
  • 14. PETER KOFLER, CODE-COP.ORG FANATIC ABOUT CODE QUALITY CC Images ● Playmobil http://www.flickr.com/photos/williac/99551756/ ● todos http://www.flickr.com/photos/kylesteeddesign/3724074594/ ● Dojo http://www.flickr.com/photos/49715404@N00/3267627038/ ● smells http://www.flickr.com/photos/hhbw/4215183405/ ● question mark http://www.flickr.com/photos/oberazzi/318947873/ ● wants you http://www.flickr.com/photos/shutter/105497713/