Smells @muc_rubyshift 06/2013
Upcoming SlideShare
Loading in...5
×
 

Smells @muc_rubyshift 06/2013

on

  • 153 views

 

Statistics

Views

Total Views
153
Views on SlideShare
153
Embed Views
0

Actions

Likes
0
Downloads
0
Comments
0

0 Embeds 0

No embeds

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

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

Smells @muc_rubyshift 06/2013 Smells @muc_rubyshift 06/2013 Presentation Transcript

  • 6/4/13 Fighting Code That Smells Anna Bulenkova JetBrains Software Developer
  • What’s that smell?
  • WARNING KEEP CHILDREN AWAY FROM THIS CONTENT
  • Why?
  • Experience
  • Interruptions
  • Tiredness
  • Who cares...
  • Other Issues
  • What happens?
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • • undefined local variable or method `call_me' for main:Object (NameError) warning: Object#id will be deprecated; use Object#object_id • warning: Object#id will be deprecated; use Object#object_id • Dead code • Copy/Paste • Complexity • code_styleAnd_FWpatternViolations
  • How to fight?
  • • Learn • Re-read • Ask for review • Pair programming • Use tools
  • Code quality tools •Static •Runtime
  • • No code run • But tool runs • No side effects • But no on-the-fly change Static tools false positeve bad alalyzing meta-programming false positeve bad alalyzing meta-programming
  • Reek • Control Couple • Data Clump • Feature Envy • Large Class/Method • Long Parameters List • Simulated Polymorphism
  • Control Couple
  • Data Clump
  • Feature Envy
  • Large Class/Method One Third
  • Long Parameter List QuickTime™ and a H.264 decompressor are needed to see this picture.
  • Simulated Polymorphism • instance_of? • kind_of? • is_a? • === • Especially with case
  • Flog • ABC Metric • |ABC| = sqrt((A*A)+(B*B)+(C*C))
  • ABC Guide Lines0-10 = Awesome •11-20 = Good enough •21-40 = Might need refactoring •41-60 = Possible to justify •61-100 = Danger •100-200 = Whoop, whoop, whoop •200 + = Someone please think of the children
  • ABC = 8.5
  • Flay • Duplicates • Ignores names / literals / values • Ignores code style
  • Roodi• Assignment in conditionals • Case missing else • Line count • Names check • Cyclomatic omplexityс • Empty rescue body • For to foreach • Parameters number подровнятьподровнять
  • metrics_fu/metrical • Flay • Flog • Rails Best Practices • Reek • Roodi • Dynamic tools • Fancy HTML report
  • Where to get?
  • Who’s gonna clean everything for me?
  • RubyMine • Inspections • Duplicates
  • RubyMine Inspections • Static • On-the-fly analysis
  • Static analysis QuickTime™ and a H.264 decompressor are needed to see this picture.
  • QuickTime™ and a H.264 decompressor are needed to see this picture. On-The-Fly Analysis
  • Duplicates
  • There’s no cure-all
  • 6/4/13 Thanks for watching!