Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

How to not create an unbreakable Rails monolith

179 views

Published on

In this talk I would like to show some cool Rails features like model callbacks, active record relationships, concerns, and MVC pattern that can make your application into a coupled monolith, hard to test and to get rid of dependencies.

For each case, use simple concepts of Clean Architecture to solve elegantly and decoupled.

Published in: Technology
  • Be the first to comment

  • Be the first to like this

How to not create an unbreakable Rails monolith

  1. 1. HOW TO NOT CREATE AN UNBREAKABLE RAILS MONOLITH
  2. 2. @wwwbruno ABOUT ME BRUNO ALMEIDA Hometown @ Lages, Brazil Ruby Engineer @ Event Inc Go, Rails, Docker and Open Source lover
  3. 3. TOPICS 1. MVC on Rails 2. Clean Architecture 3. Rails code Examples
  4. 4. OBJECTIVE Share experience with problem using Rails “Architecture” Show another point of view, that is also not perfect “What can I do better?”
  5. 5. INSPIRATION UNCLE BOB
  6. 6. 1. MVC ON RAILS
  7. 7. WHAT IS RUBY ON RAILS?"Rails is a model–view–controller (MVC) framework" Wikipedia
  8. 8. WHAT IS MVC?
  9. 9. TRYGVE REENSKAUG
  10. 10. WHAT IS WEB?
  11. 11. WEB IS ONLY A DETAIL
  12. 12. 2. CLEAN ARCHITECTURE
  13. 13. FRAMEWORKS AND DRIVERS SMALL DETAILS LIKE DATABASE AND WEB
  14. 14. INTERFACE ADAPTERS CONVERT DATA TO USE CASES AND EXTERNAL AGENCIES
  15. 15. USE CASES APPLICATION SPECIFIC RULES
  16. 16. ENTITIES GENERAL AND HIGH LEVEL RULES
  17. 17. CROSS BOUNDARIES DATA STRUCTURE
  18. 18. WHY USE CLEAN CODE ARCHITECTURE?
  19. 19. DEPENDENCY
  20. 20. BETTER TO MAINTAIN, TEST, CHANGE, DEBUG…
  21. 21. HOW EASY IS TO CHANGE RAILS TO SINATRA?
  22. 22. AND FROM A CONTROLLER TO A SIDEKIQ JOB?
  23. 23. 3. RAILS CODE EXAMPLE
  24. 24. DISCLAIMER
  25. 25. SIMPLE TASK - Create a user - Validate name presence - Validate email presence and uniqueness - Send email after create
  26. 26. UsersController User WelcomeMailer Validations
  27. 27. PO REQUEST - Create user without sending email on Admin - Send email to existent user on Admin - Create user without password on Admin
  28. 28. UsersController User WelcomeMailer Validations
  29. 29. UsersController UserService WelcomeMailer Validations User
  30. 30. LOOK FOR RUBY MIDWEST 2011 - KEYNOTE: ARCHITECTURE THE LOST YEARS BY ROBERT MARTIN
  31. 31. LOOK FOR THE CLEAN ARCHITECTURE
  32. 32. LOOK FOR CLEAN ARCHITECTURE: A CRAFTSMAN'S GUIDE TO SOFTWARE STRUCTURE AND DESIGN (ROBERT C. MARTIN SERIES)
  33. 33. THANK YOU Resources https://8thlight.com/blog/uncle-bob/2012/08/13/the-clean-architecture.html https://www.youtube.com/watch?v=WpkDN78P884 https://blog.arkency.com/2014/04/mastering-rails-validations-contexts/ https://blog.arkency.com/2014/05/mastering-rails-validations-objectify/ BRUNO ALMEIDA github.com/wwwbruno linkedin.com/in/wwwbruno brunom.almd@gmail.com

×