Your SlideShare is downloading. ×
0
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
Mistakes I have made
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

Mistakes I have made

596

Published on

Antipatterns I've been guilty of in Ruby. Why they've happened, and what you can do to prevent them.

Antipatterns I've been guilty of in Ruby. Why they've happened, and what you can do to prevent them.

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
596
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
3
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. Mistakes? I've had a few Andrew Grimm @andrewjgrimm
  • 2. Excessively large classes <ul><li>Causes </li><ul><li>Adding new features
  • 3. Fear of passing around data </li></ul><li>Not a problem until modifying existing code was required </li></ul>
  • 4. Excessively large classes <ul><li>Break into smaller classes
  • 5. Or modules if you must
  • 6. def_delegator :@sub_object, :method_foo </li></ul>
  • 7. Side effects <ul><li>Does your method really need to produce output? Can't it produce a string instead?
  • 8. You can manipulate strings. You can't manipulate output. </li></ul>
  • 9. Side effects <ul><li>When testing, how often are you interested in writing to file or writing to a DB?
  • 10. Aren't you interested in the contents instead? </li></ul>
  • 11. Side effects <ul><li>Side-effect-free code is easier to test, faster to test, and safer to test </li></ul>
  • 12. Schlemiel the painter <ul><li>Doing something a million times you only need to do a few times (literally!)
  • 13. Often the result of mixing separate tasks together </li></ul>
  • 14. Why maintainability matters <ul><li>Additional functionality
  • 15. Modifying functionality
  • 16. Improving performance </li></ul>
  • 17. Testing <ul><li>If you can't write tests, it may not mean you're bad at testing </li><ul><li>It may mean the production code is bad </li></ul></ul>
  • 18. Version control <ul><li>Best form of documentation I had
  • 19. What was I thinking when I wrote that code?
  • 20. Large commits are a code smell </li></ul>

×