Component-based Ruby and Rails Architectures @ Mountain West Ruby 2013

Component-based Ruby and Rails Architectures @ Mountain West Ruby 2013

How to organize Ruby and Rails codebases into small(er) components. The 8 steps can be found as tags in the sample repository: github.com/shageman/the_next_big_thing

Affa5b7b3a311fcf5f868859d586b410?s=128

shagemann

April 05, 2013
Tweet

Transcript

  1. Saturday, April 6, 13

  2. The end to my last talk Saturday, April 6, 13

  3. All gems start with a namespace Saturday, April 6, 13

  4. No Rails app starts with a namespace Saturday, April 6,

    13
  5. Rails Gems Saturday, April 6, 13

  6. (a gorgeous and infinite nothingness) Rails Gems Saturday, April 6,

    13
  7. (a gorgeous and infinite nothingness with all the bells and

    whistles of active*) Rails Gems Saturday, April 6, 13
  8. Try this! Namespace everything in your next app Saturday, April

    6, 13
  9. Give yourself a box so you can start thinking outside

    of it Saturday, April 6, 13
  10. Component-based Ruby and Rails Architectures Stephan Hagemann Saturday, April 6,

    13
  11. Saturday, April 6, 13

  12. Let’s talk about large apps Saturday, April 6, 13

  13. Never build large apps. Saturday, April 6, 13

  14. Saturday, April 6, 13

  15. Your app wants to kill you! Sandi Metz Saturday, April

    6, 13
  16. HTTP://WWW.FLICKRIVER.COM/PHOTOS/REXY85/263649949/ Saturday, April 6, 13

  17. HTTP://WWW.PBASE.COM/SIGMADSLR/IMAGE/34745521 Saturday, April 6, 13

  18. HTTP://WWW.PELAPAPAS.COM.MX/HTMLS/GENTE_ANIMALES.HTML Saturday, April 6, 13

  19. The secret to building large apps is never build large

    apps. Justin Meyer Saturday, April 6, 13
  20. The secret to building large apps is never build large

    apps. Break your applications into small pieces. Then, assemble those testable, bite- sized pieces into your big application Justin Meyer Saturday, April 6, 13
  21. But how? Saturday, April 6, 13

  22. github.com/shageman/the_next_big_thing Saturday, April 6, 13

  23. Saturday, April 6, 13

  24. 5 looser coupling 3 gems 1 one app 4 engines

    8 HTTP SOA 2 modules 7 eco-system 6 services Saturday, April 6, 13
  25. 1 The one app Saturday, April 6, 13

  26. Remember! a gorgeous and infinite nothingness with all the bells

    and whistles of active* Saturday, April 6, 13
  27. HTTP://WWW.FLICKR.COM/PHOTOS/WIDNR/6589525327/ Saturday, April 6, 13

  28. ANNOYANCE ENTRY STRUCTURE Saturday, April 6, 13

  29. 2 The modularized app Saturday, April 6, 13

  30. + A higher level structure Saturday, April 6, 13

  31. HTTP://WWW.FLICKR.COM/PHOTOS/WIDNR/6589525327/ Saturday, April 6, 13

  32. HTTP://EECUE.COM/P/31426/METAL-RECYCLING-YARD.HTML Saturday, April 6, 13

  33. ANNOYANCE EMAIL SIGNUP STRUCTURE Saturday, April 6, 13

  34. 3 The gem component app Saturday, April 6, 13

  35. + Provably independent tests Saturday, April 6, 13

  36. Choose modules that tell the story of the system and

    contain a cohesive set of concepts Eric Evans Saturday, April 6, 13
  37. Saturday, April 6, 13

  38. HTTP://WWW.SMASHINGMAGAZINE.COM/INFORMATION-AND-INSTRUCTIONAL-SIGNS-PART-1/ Saturday, April 6, 13

  39. ANNOYANCE EMAIL SIGNUP STRUCTURE Saturday, April 6, 13

  40. 4 The Rails component app Saturday, April 6, 13

  41. + Provable structure for Rails Saturday, April 6, 13

  42. Rails Engines Saturday, April 6, 13

  43. Engines are not just for pagination, generic admin, and authentication

    Saturday, April 6, 13
  44. Engines are not just kaminari, generic admin, and authentication Saturday,

    April 6, 13
  45. Engines are not just kaminari, active admin, and authentication Saturday,

    April 6, 13
  46. Engines are not just kaminari, active admin, and devise Saturday,

    April 6, 13
  47. Rails::Engine allows you to wrap a specific Rails application or

    subset of functionality and share it with other applications or within a larger packaged application. http://edgeapi.rubyonrails.org/classes/ Rails/Engine.html Saturday, April 6, 13
  48. EMAIL SIGNUP TEASER STRUCTURE ANNOYANCE Saturday, April 6, 13

  49. What code smell did you see? Saturday, April 6, 13

  50. Single Responsibility Saturday, April 6, 13

  51. 5 The loosely-coupled app Saturday, April 6, 13

  52. + Clearer responsibilities Saturday, April 6, 13

  53. EMAIL SIGNUP TEASER STRUCTURE ANNOYANCE EVENT COUNTER Saturday, April 6,

    13
  54. 6 The service-oriented app Saturday, April 6, 13

  55. + Reduced surface area Saturday, April 6, 13

  56. 588 194 LOGGER::COUNT EVENTCOUNTER::*.METHODS.COUNT LOGGER 361 115 Saturday, April 6,

    13
  57. 588 194 LOGGER::COUNT EVENTCOUNTER::*.METHODS.COUNT LOGGER 361 115 - OBJECT.METHODS LOGGER::COUNT

    LOGGER 394 0 247 1 Saturday, April 6, 13
  58. EMAIL SIGNUP TEASER STRUCTURE ANNOYANCE EVENT COUNTER Saturday, April 6,

    13
  59. 7 The eco-system app Saturday, April 6, 13

  60. gem build event_counter.. Saturday, April 6, 13

  61. gem push event_counter.. Saturday, April 6, 13

  62. Saturday, April 6, 13

  63. EMAIL SIGNUP TEASER STRUCTURE ANNOYANCE EVENT COUNTER Saturday, April 6,

    13
  64. 8 The HTTP SOA app Saturday, April 6, 13

  65. Saturday, April 6, 13

  66. STRUCTURE EMAIL SIGNUP TEASER ANNOYANCE EVENT COUNTER Saturday, April 6,

    13
  67. Saturday, April 6, 13

  68. 5 looser coupling 3 gems 1 one app 4 engines

    8 HTTP SOA 2 modules 7 eco-system 6 services Saturday, April 6, 13
  69. Saturday, April 6, 13

  70. Saturday, April 6, 13

  71. 5 looser coupling 3 gems 1 one app 4 engines

    8 HTTP SOA 2 modules 7 eco-system 6 services Saturday, April 6, 13
  72. Thanks! Stephan Hagemann @shageman stephan@pivotallabs.com Saturday, April 6, 13