Architecting Rails apps

Studies and thoughts from a Front End perspective.

Iago Dahlem

  • Passionate about web and it's ecossystem
  • JavaScript Addicted (also like Ruby)
  • Software Developer at Codeminer 42
  • Florianópolis

We Are Hiring!

become@codeminer42.com

Disclaimers

  • No code examples :(
  • Keep focus on the theory
  • Don't get it to hard

Why Front-end Perspective?

  • Common problems
  • Same responsibilities

The bad Rails

  • Built on top of MVC
  • Changes affects other parts of the app
  • Top level structure screams the web framework
  • We don't know what it does

MVC is a delivery design pattern.

- Uncle Bob

What is Architecture anyway?!

  • Independent of technology/framework
  • Makes software easier to change and test

Domain layer

Application layer

Infrastructure layer

Input layer

Domain Layer

  • Entities and business Rules
  • Used by the application layer to define use cases
  • Examples: User, Article

Application Layer

  • Use cases and actual behavior
  • Interacts with Domain units
  • Adapts the Infrastructure Layer
  • Examples: CreateUser, CreateArticle

Infrastructure Layer

  • Interacts with the external world of the application
  • The lowest of them
  • Databases, email services, external APIs
  • Examples: UserRepository, MailChimpService, ArticlesService

Input Layer

  • The entry point
  • Should only receives user input
  • Returns a response to the user
  • Controllers, CLIs, WebSockets, GUIs
  • Examples: UsersController, ArticlesController

Summarizing

  • Keep it simple
  • You don't need to use everything
  • Find what works better for and your business
  • Make it fun

Additional Information

Thanks!

iagodahlem.com

@iagodahlem