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

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Smells @muc_rubyshift 06/2013

79

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
79
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
1
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. 6/4/13 Fighting Code That Smells Anna Bulenkova JetBrains Software Developer
  • 2. What’s that smell?
  • 3. WARNING KEEP CHILDREN AWAY FROM THIS CONTENT
  • 4. Why?
  • 5. Experience
  • 6. Interruptions
  • 7. Tiredness
  • 8. Who cares...
  • 9. Other Issues
  • 10. What happens?
  • 11. • 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
  • 12. • 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
  • 13. • 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
  • 14. • 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
  • 15. • 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
  • 16. • 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
  • 17. How to fight?
  • 18. • Learn • Re-read • Ask for review • Pair programming • Use tools
  • 19. Code quality tools •Static •Runtime
  • 20. • 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
  • 21. Reek • Control Couple • Data Clump • Feature Envy • Large Class/Method • Long Parameters List • Simulated Polymorphism
  • 22. Control Couple
  • 23. Data Clump
  • 24. Feature Envy
  • 25. Large Class/Method One Third
  • 26. Long Parameter List QuickTime™ and a H.264 decompressor are needed to see this picture.
  • 27. Simulated Polymorphism • instance_of? • kind_of? • is_a? • === • Especially with case
  • 28. Flog • ABC Metric • |ABC| = sqrt((A*A)+(B*B)+(C*C))
  • 29. 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
  • 30. ABC = 8.5
  • 31. Flay • Duplicates • Ignores names / literals / values • Ignores code style
  • 32. Roodi• Assignment in conditionals • Case missing else • Line count • Names check • Cyclomatic omplexityс • Empty rescue body • For to foreach • Parameters number подровнятьподровнять
  • 33. metrics_fu/metrical • Flay • Flog • Rails Best Practices • Reek • Roodi • Dynamic tools • Fancy HTML report
  • 34. Where to get?
  • 35. Who’s gonna clean everything for me?
  • 36. RubyMine • Inspections • Duplicates
  • 37. RubyMine Inspections • Static • On-the-fly analysis
  • 38. Static analysis QuickTime™ and a H.264 decompressor are needed to see this picture.
  • 39. QuickTime™ and a H.264 decompressor are needed to see this picture. On-The-Fly Analysis
  • 40. Duplicates
  • 41. There’s no cure-all
  • 42. 6/4/13 Thanks for watching!

×