Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Structural Engineering in Ruby

shagemann
January 31, 2020

Structural Engineering in Ruby

Morning keynote at Birmingham on Rails in Birmingham, AL in January 31, 2020

https://birminghamonrails.com/

shagemann

January 31, 2020
Tweet

More Decks by shagemann

Other Decks in Technology

Transcript

  1. Big or Small? Stand up if in your codebase you…

    • have more than 50 models • have a class with more than a 1000 LOC • have an ActiveRecord model with more than 30 :has_many • can’t run your full test suite on your machine • can’t run your test suite on your machine in under 20 minutes
  2. Namespace 2 LOC Costs Prevent naming collisions in the global

    namespace Benefits Group 
 classes 
 and methods
  3. Structure Benefit Cost Method Allow reuse, 
 hide logic 2

    Class Bundle logic and data, allow reuse 2 Namespace Prevent naming collisions, group classes and methods 2
  4. Gem

  5. Gem 88 LOC Costs Create provably independent
 package of 


    code Benefits bundle gem awesome_lib Allow 
 Distribution
  6. Gem + Engine 528 LOC Costs Create provably independent
 package

    of 
 code with 
 Rails Benefits rails plugin new components/awesome_engine --full --mountable Allow 
 Distribution
  7. Structure Benefit Cost Method Allow reuse, 
 hide logic 2

    Class Bundle logic and data, allow reuse 2 Namespace Prevent naming collisions, group classes and methods 2 Component Allow Distribution, Create provably independent package of code 88 Rails Component Allow Distribution, Create provably independent package of code with Rails 528
  8. 1 component with 100 elements 1,267,650,600,228,230,000,000,000,000,000 2 component with 50

    elements 2,251,799,813,685,150 4 component with 25 elements 134,217,624 5 component with 20 elements 5,242,775 10 component with 10 elements 10,130 * assuming a lot of stuff, including complexity growing according to Reed’s law
  9. Structure Benefit Cost Method Allow reuse, 
 hide logic 2

    Class Bundle logic and data, allow reuse 2 Namespace Prevent naming collisions, group classes and methods 2 Component Allow Distribution, Create provably independent package of code 88 Rails Component Allow Distribution, Create provably independent package of code with Rails 528
  10. Structure Benefit Cost Method Allow reuse, 
 hide logic 2

    Class Bundle logic and data, allow reuse 2 Namespace Prevent naming collisions, group classes and methods 2 Component Allow Distribution, Create provably independent package of code 88 Rails Component Allow Distribution, Create provably independent package of code with Rails 528