Your SlideShare is downloading. ×
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
Refactoring code smell
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

Refactoring code smell

1,487

Published on

A small presentation on how one could start refactoring ruby code. …

A small presentation on how one could start refactoring ruby code.
- check the hotspots
- check your tests
- make it nice
-don't forget security

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

No Downloads
Views
Total Views
1,487
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
1
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
  • "http://www.amazon.de/gp/product/0321604814/ref=as_li_ss_tl?ie=UTF8&camp=1638&creative=19454&creativeASIN=0321604814&linkCode=as2&tag=woweffekt-21"
  • "http://www.amazon.de/gp/product/0321604814/ref=as_li_ss_tl?ie=UTF8&camp=1638&creative=19454&creativeASIN=0321604814&linkCode=as2&tag=woweffekt-21"
  • Transcript

    • 1. RefactoringDoes your code smell? by Martin Tschischauskas
    • 2. Author• http://twitter.com/MartynasC• https://www.xing.com/profile/Martin_Ts chischauskas Martin Tschischauskas • Diplom Technische Informatik / Computer Engineering • Ruby on Rails Developer • XING AG • Jobs TeamMartin Tschischauskas Refactoring – Does your code smell?
    • 3. Motivation gems Tools ConclusionMartin Tschischauskas Refactoring – Does your code smell?
    • 4. MotivationDoes your code smell?Martin Tschischauskas Refactoring – Does your code smell?
    • 5. MotivationSituation at workMartin Tschischauskas Refactoring – Does your code smell?
    • 6. MotivationLots of articles / booksMartin Tschischauskas Refactoring – Does your code smell?
    • 7. MotivationBut how to start?Martin Tschischauskas Refactoring – Does your code smell?
    • 8. gemsCode SadistMartin Tschischauskas Refactoring – Does your code smell?
    • 9. floggem install flogfind yourapp -name *.rb | xargs flogMartin Tschischauskas Refactoring – Does your code smell?
    • 10. flog• ABC metrics• computed by counting the number of assignments, branches and conditions for a section of code • Assignment - an explicit transfer of data into a variable • Branch - an explicit forward program branch out of scope - a function call, class method call, or new operator • Condition - a logical/Boolean test• |ABC| = sqrt((A*A)+(B*B)+(C*C))• http://ruby.sadi.st/Flog.htmlMartin Tschischauskas Refactoring – Does your code smell?
    • 11. flaygem install flayfind yourapp -name *.rb | xargs flayMartin Tschischauskas Refactoring – Does your code smell?
    • 12. flay• DRY – Don’t Repeat yourself• Analyzes ruby code for structural similarities • Differences in literal values, • Names, • Whitespace, • Programming style • Are ignored• http://ruby.sadi.st/Flay.htmlMartin Tschischauskas Refactoring – Does your code smell?
    • 13. hecklegem install heckleheckle Class method –t path_to_your_test –T timeout_in_secondsMartin Tschischauskas Refactoring – Does your code smell?
    • 14. heckle• Mutation tester• Changes code and checks if tests fail• If tests still succeed • Code is not covered • Or code does nothing• http://ruby.sadi.st/Heckle.htmlMartin Tschischauskas Refactoring – Does your code smell?
    • 15. reekgem install reekfind yourapp -name *.rb | xargs reekMartin Tschischauskas Refactoring – Does your code smell?
    • 16. reek• Detects code smell • Long Method • Large Class • Feature Envy (using methods of different class excessively) • Uncommunicative Name • Long Parameter List • Nested Iterators • https://github.com/troessner/reek/wiki/Code-SmellsMartin Tschischauskas Refactoring – Does your code smell?
    • 17. brakemangem install brakemanbrakeman yourappMartin Tschischauskas Refactoring – Does your code smell?
    • 18. brakeman• Detects possible security issues• No configuration is needed• Finds possible • XSS • SQL Injection • …• http://brakemanscanner.org/Martin Tschischauskas Refactoring – Does your code smell?
    • 19. rails_best_ practisesgem install rails_best_practisesrails_best_practices -f htmlMartin Tschischauskas Refactoring – Does your code smell?
    • 20. rails_best_ practises• Tries to check code for rails best practises• Move code from Controller to Model• RESTful Conventions• Model• Mailer• Migration• …• http://rails-bestpractices.com/Martin Tschischauskas Refactoring – Does your code smell?
    • 21. Code climatehttps://codeclimate.com/github/rails/railsMartin Tschischauskas Refactoring – Does your code smell
    • 22. ???ThankYou!Martin Tschischauskas Refactoring – Does your code smell?
    • 23. Credits http://www.flickr.com/photos/dana_moos/5495380861/sizes/o/in/photostream/ http://www.flickr.com/photos/digitalsextant/4842845805/sizes/o/in/photostream/ http://www.flickr.com/photos/seatbelt67/502255276/sizes/o/in/photostream/Martin Tschischauskas Refactoring – Does your code smell?

    ×