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

Large scale rails applications

Flo
December 20, 2016

Large scale rails applications

I started using Rails in 2007 on version 1.2.3. Since that time I've noticed that, whatever version of Rails we're using, things end up pretty complex and messy as soon as the application scope is reaching a decent size.
In this talk, we try to identify why this always happen and give some leads on how to avoid that.

Flo

December 20, 2016
Tweet

Other Decks in Programming

Transcript

  1. User specs (1) • User can signup through site /

    API • When a user signup, we send an email to confirm it’s email address
  2. User specs (2) • Admins can create users through admin

    tool • When admin create a user, we auto-generate the password and send it through email
  3. User specs (3) • We have a partnership with another

    solution (A) and we need to share our users • We will consume A’s API to collect users and insert them in our DB • When we register a new user this, we don’t send any email (email is assumed confirmed already and we can grab their password from API).
  4. Benefits • Easy to test (mock client responses) • New

    provider => new adapter • Easy to migrate • Fake adapters for integration servers
  5. Principles • Single Responsibility Object • Plain Old Ruby Objects

    • Inversion Of Control • Stateless Objects • Domain Specific Modeling
  6. SRP

  7. Pros • Easier to browse and discover • More flexible

    • Easier to test • Easier to debug • Agnostic (from Rails)
  8. Cons • Harder to design • More time spent on

    code architecture • Write more code, more tests • Write integration tests (IOC)
  9. Soft transition • Code convention • Focus on data and

    API • Express everything in Domain Language • Write adapters early • Prepare to drop Rails prototyping tools ASAP
  10. More tips • If it doesn’t fit anywhere, think twice

    • If it still doesn’t fit anywhere, you need a new layer • Check what Java / React community does