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

Jengas & Legos: Rails as a stack of components

chubas
June 11, 2012

Jengas & Legos: Rails as a stack of components

Talk about Rails apps' architecture seeing it as a stack of different components, using Jenga and Legos as a metaphor for coupling and cohesion. Talk given at MagmaRails 2012

chubas

June 11, 2012
Tweet

More Decks by chubas

Other Decks in Programming

Transcript

  1. Jengas y Legos: Rails como un Stack de componentes Rubén

    Medellín @chubas [email protected] LEGO® is trademark of The Lego Group Jenga® is trademark of Hasbro
  2. Friction The most changing parts are the ones related to

    your application’s logic The other ones change too little that other people already did that for you
  3. Where does the vendor code live? config.ac)on_mailer.default_url_op)ons  =  {…}  

    config.assets.ini)alize_on_precompile  =  false   rails  g  devise  User   devise  :database_authen)catable,  :)meoutable   devise_for  :admins   before_filter  :authen)cate_admin!   user_signed_in?   current_user  
  4. How should I program, then? “Knowing the difference between what

    the Rails documentation says Rails developers do, and what Rails developers actually do” Giles Bowkett
  5. Library smells •  The library does too much or too

    little •  You need to patch the library to fit your application •  A lot of gem dependencies •  The gem dependencies duplicate or conflict with your gems •  Coupling through global variables, Rails or Ruby patches •  Lack of test coverage •  Not mature/stable. Unclear interface. •  No active maintenance or community •  Hard to read and understand. A lot of code. Peter  Marklund   hFp://marklunds.com/  
  6. What to do Minimize dependencies “look at all the libraries

    I’m not depending on!” There’s the inevitable code you cannot get rid of
  7. What to do Use alternatives to monkey patching Extending modules,

    aliasing method chains, create façades and adapters
  8. As a plugin / gem developer •  Do only one

    thing. If you can, do less than that •  Clearly expose your interfaces, but provide hooks •  If you provide multiple functionalities, make sure those are decoupled