Ola.	
  
You’re	
  
making	
  me	
  	
  
 refactor.	
  

You	
  won’t	
  
 like	
  me	
  
  when	
  I	
  
 refactor	
  
Thoughtworks Brazil, Code Quality
Refactoring?	
  
a	
  change	
  made	
  to	
  the	
  internal	
  
                   structure	
  of	
  so=ware	
  to	
  make	
  it	
  
                   easier	
  to	
  understand	
  and	
  cheaper	
  
                   to	
  modify	
  without	
  
                   changing	
  its	
  
                   observable	
  behavior	
  




ThoughtWorks	
  
Thoughtworks Brazil, Code Quality
 Don't	
  touch	
  anything	
  that	
  doesn't	
  
                have	
  coverage.	
  




Otherwise,	
  you're	
  not	
  refactoring;	
  
    you're	
  just	
  changing	
  shit	
  
a	
  change	
  made	
  to	
  the	
  internal	
  
                   structure	
  of	
  so=ware	
  to	
  make	
  it	
  

                   easier	
  to	
  
                   understand	
  and	
  
                   cheaper	
  to	
  
                   modify	
  without	
  changing	
  
                   its	
  observable	
  behavior	
  




ThoughtWorks	
  
SomeHmes	
  it	
  just	
  feels	
  right.	
  
Thoughtworks Brazil, Code Quality
Thoughtworks Brazil, Code Quality
Thoughtworks Brazil, Code Quality
Step	
  1:	
  
Measure	
  the	
  
 toxicity.	
  
Thoughtworks Brazil, Code Quality
Smells	
  in	
  the	
  code	
  
CyclomaHc	
  Complexity	
  




5	
  to	
  7	
  is	
  decent	
  for	
  
most	
  ruby	
  code	
  
Saikuro	
  
Assignments,	
  Branches,	
  Calls	
  	
  
           with	
  Flog	
  




Watch	
  for	
  scores	
  
greater	
  than	
  40	
  
Flog	
  
DuplicaHon	
  with	
  Flay	
  




Watch	
  for	
  scores	
  
greater	
  than	
  30	
  
Thoughtworks Brazil, Code Quality
Control	
  Couples	
  and	
  more	
  	
  
                   with	
  Reek	
  




Simulated	
  Polymorphism	
  
Feature	
  Envy	
  
UHlity	
  Methods	
  
LinHng	
  with	
  Dust/Nitpick	
  




JSLint	
  for	
  Ruby	
  
Common	
  smells	
  	
  
   in	
  Ruby	
  	
  
PrimiHve	
  Obsession	
  
Feature	
  Envy	
  
Meta-­‐programming	
  




 Keep	
  it	
  simple.	
  	
  
 Keep	
  it	
  declaraHve	
  
Thoughtworks Brazil, Code Quality
Toxicity	
  is	
  more	
  than	
  code	
  smells	
  
“The	
  real	
  problem	
  I	
  have	
  with	
  the	
  CK	
  suite	
  and	
  similar	
  
metrics	
  is	
  that	
  they	
  only	
  measure	
  a	
  single	
  module	
  (or	
  class	
  in	
  
this	
  case).	
  	
  
I	
  claim	
  that	
  the	
  quality	
  of	
  the	
  design	
  of	
  a	
  system	
  is	
  not	
  
something	
  that	
  can	
  be	
  determined	
  by	
  looking	
  at	
  individual	
  
classes.	
  	
  
It	
  is	
  conceivable	
  that	
  every	
  class	
  in	
  a	
  system	
  could	
  be	
  
considered	
  reasonable	
  by	
  whatever	
  single-­‐class	
  metrics	
  are	
  
being	
  used,	
  but	
  the	
  overall	
  design	
  is	
  considered	
  bad.”	
  
Ewan	
  Tempero:	
  A	
  Research	
  Agenda	
  



                                                             hDp://www.cs.auckland.ac.nz/~ewan/	
  
DEPENDENCY	
  
Tangles	
  
Step	
  2:	
  Make	
  it	
  visible	
  
Treemaps	
  (Max	
  CC)	
  




hbp://mbostock.github.com/protovis/	
  
Treemaps	
  
Dependency	
  matrix	
  
Step	
  3:	
  Agree	
  on	
  the	
  fix	
  
Thoughtworks Brazil, Code Quality
Thoughtworks Brazil, Code Quality
Step	
  4:	
  	
  	
  
Go	
  fix	
  it	
  
Obrigado	
  

More Related Content

PPT
Enterprise Gamification @ Gamified.in 2013
PDF
RubyConf Brazil 2011
PDF
RubyConf Uruguay 2011
PDF
Fighting Ruby code smell
PDF
Culture And Aesthetic Revisited
PPTX
Code smell overview
DOCX
A Study on Code Smell Detection with Refactoring Tools in Object Oriented Lan...
POT
Quality metrics and angular js applications
Enterprise Gamification @ Gamified.in 2013
RubyConf Brazil 2011
RubyConf Uruguay 2011
Fighting Ruby code smell
Culture And Aesthetic Revisited
Code smell overview
A Study on Code Smell Detection with Refactoring Tools in Object Oriented Lan...
Quality metrics and angular js applications

Similar to Thoughtworks Brazil, Code Quality (20)

PPTX
Slides for Houston iPhone Developers' Meetup (April 2012)
 
PPTX
Ruby code smells
PDF
festival ICT 2013: Ruby, the 0.8 language you were looking for
PDF
July 2012 Ruby Tuesday - Lana Lodge - Refactoring Lighting Talk
PDF
Quick Intro to Clean Coding
PDF
How to write good quality code
KEY
Frozen rails 2012 - Fighting Code Smells
PPTX
Code smells and Other Malodorous Software Odors
PDF
Refactoring 2 The Max
PDF
Day2 - Refactoring (Lecture SS 2015)
PPTX
Refactoring code smell
PDF
KEY
Ruby codebases in an entropic universe
ODP
Documenting Code - Patterns and Anti-patterns - NLPW 2016
ODP
Documenting code yapceu2016
PDF
Ruby, Meet iPhone
PDF
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
PDF
Refactoring
PPTX
Refactoring workshop
PDF
Fighting code smells
Slides for Houston iPhone Developers' Meetup (April 2012)
 
Ruby code smells
festival ICT 2013: Ruby, the 0.8 language you were looking for
July 2012 Ruby Tuesday - Lana Lodge - Refactoring Lighting Talk
Quick Intro to Clean Coding
How to write good quality code
Frozen rails 2012 - Fighting Code Smells
Code smells and Other Malodorous Software Odors
Refactoring 2 The Max
Day2 - Refactoring (Lecture SS 2015)
Refactoring code smell
Ruby codebases in an entropic universe
Documenting Code - Patterns and Anti-patterns - NLPW 2016
Documenting code yapceu2016
Ruby, Meet iPhone
[DevDay2018] Let’s all get along. Clean Code please! - By: Christophe K. Ngo,...
Refactoring
Refactoring workshop
Fighting code smells
Ad

More from Nigel Fernandes (17)

PPTX
Digital Transformation Summit - Melbourne 2019
PPTX
Ipqc Enterprise Architecture Summit - Melbourne 2019
PPTX
Exploiting Serverless - DevOps Conference Sydney 2018
PPTX
Looking at your Technology company through the "3 Horizons of growth" model.
PPTX
Agile Software Development (Monash University - Guest Lecture series)
PDF
Microservices meetup
PPTX
Seek test-invaders
PDF
My career lessons - for Monash Students at Battle of the Brains 215
PPTX
Lessons learnt the hard way.
PPTX
Lean Programmer Anarchy
PDF
Towards a responsive business - DevOps MeetUp Melbourne 2013
PPTX
Towards a responsive business, the developer way
PDF
DevOps Days Melbourne meet-up
PPTX
LAST Conference - Dev-Ops and Continuous Delivery
PPTX
Continuous Delivery and the Cloud
PPTX
Continuous Delivery in the AWS Cloud
PDF
Test Engineering
Digital Transformation Summit - Melbourne 2019
Ipqc Enterprise Architecture Summit - Melbourne 2019
Exploiting Serverless - DevOps Conference Sydney 2018
Looking at your Technology company through the "3 Horizons of growth" model.
Agile Software Development (Monash University - Guest Lecture series)
Microservices meetup
Seek test-invaders
My career lessons - for Monash Students at Battle of the Brains 215
Lessons learnt the hard way.
Lean Programmer Anarchy
Towards a responsive business - DevOps MeetUp Melbourne 2013
Towards a responsive business, the developer way
DevOps Days Melbourne meet-up
LAST Conference - Dev-Ops and Continuous Delivery
Continuous Delivery and the Cloud
Continuous Delivery in the AWS Cloud
Test Engineering
Ad

Recently uploaded (20)

PPTX
Final SEM Unit 1 for mit wpu at pune .pptx
PDF
WOOl fibre morphology and structure.pdf for textiles
PDF
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
PDF
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
PPTX
Group 1 Presentation -Planning and Decision Making .pptx
PDF
Five Habits of High-Impact Board Members
PDF
A review of recent deep learning applications in wood surface defect identifi...
PDF
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
PDF
Zenith AI: Advanced Artificial Intelligence
PDF
Getting Started with Data Integration: FME Form 101
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPT
Module 1.ppt Iot fundamentals and Architecture
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Getting started with AI Agents and Multi-Agent Systems
PDF
Taming the Chaos: How to Turn Unstructured Data into Decisions
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
DP Operators-handbook-extract for the Mautical Institute
PPTX
Modernising the Digital Integration Hub
PDF
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game
Final SEM Unit 1 for mit wpu at pune .pptx
WOOl fibre morphology and structure.pdf for textiles
A Late Bloomer's Guide to GenAI: Ethics, Bias, and Effective Prompting - Boha...
DASA ADMISSION 2024_FirstRound_FirstRank_LastRank.pdf
Group 1 Presentation -Planning and Decision Making .pptx
Five Habits of High-Impact Board Members
A review of recent deep learning applications in wood surface defect identifi...
Hybrid horned lizard optimization algorithm-aquila optimizer for DC motor
Zenith AI: Advanced Artificial Intelligence
Getting Started with Data Integration: FME Form 101
Assigned Numbers - 2025 - Bluetooth® Document
Module 1.ppt Iot fundamentals and Architecture
Hindi spoken digit analysis for native and non-native speakers
Getting started with AI Agents and Multi-Agent Systems
Taming the Chaos: How to Turn Unstructured Data into Decisions
A novel scalable deep ensemble learning framework for big data classification...
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
DP Operators-handbook-extract for the Mautical Institute
Modernising the Digital Integration Hub
TrustArc Webinar - Click, Consent, Trust: Winning the Privacy Game

Thoughtworks Brazil, Code Quality