It's OK to make a new folder within Rails.


Published on

Published in: Technology, Education
  • Be the first to comment

  • Be the first to like this

It's OK to make a new folder within Rails.

  1. 1. Its OK to make a new folder within Rails. Collin Schaafsma, Founder @ Quick Left @collinschaafsma
  2. 2. My Rails app just got complex bro so now what?
  3. 3. (Clojure)
  4. 4. Node.js
  5. 5. JKLOLthis is a ruby / rails talk
  6. 6. WTF is Rails
  7. 7. WTF is Railsit’s why we can’t have nice things
  8. 8. WTF is a FrameworkI promise this is the last time we define something in this talk
  9. 9. Just to be clear I like Rails
  10. 10. But... Rails is not your app
  11. 11. Has Rails owned your app?
  12. 12. What does this remind you of?
  13. 13. So. What is a model?I lied, we are about to define something again
  14. 14. Classes that store, and optionally separate, data Persistence mother-fu@*er!
  15. 15. How do we break this apart?
  16. 16. This is not a new problem Most likely it’s been solved before
  17. 17. Facades BridgesFactories Presenters Decorators Proxies Mediators Builders Reactors Observers
  18. 18. But wait, we have three choices
  19. 19. model / view / controllerwe can randomly toss shit in helpers/ and lib/
  20. 20. Don’t let Rails kill your software design skills you’re smarter than that
  21. 21. Example Apps Oh snap. Real code.
  22. 22. Why? Dude. I gotta get shit done.If you don’t have time to do it right, when will you have time to do itover? John WoodenThe only way to make the deadline -- the only way to go fast -- is tokeep the code as clean as possible at all times. Robert C. Martin
  23. 23. S.O.L.I.DFolks can grock itEasier Refactoring Testable Code
  24. 24. Speaking of testing
  25. 25. Speaking of testingTesting should be fast. Really fast.
  26. 26. Step (1) Cut a hole in a box
  27. 27. Step (2) Don’t put Rails in that box
  28. 28. Example CodeDamn son. More code.
  29. 29. TDD promotes good design TDD might not actually suck!
  30. 30. The word on the streetWe need something better. Persistence and logic are two separateresponsibilities that every rails app combines. Steve KlabnikI pull the behavior out of my models into other objects that wrap themodels. I prefer to make the AR objects simple wrappers around the db-access stuff in AR. Corey Haines
  31. 31. Let’s recap
  32. 32. Thanks!
  33. 33. Resources Example Rails app Example Sinatra app More resources @collinschaafsma