SlideShare uma empresa Scribd logo
1 de 43
Baixar para ler offline
HOW TO NOT CREATE AN
UNBREAKABLE RAILS
MONOLITH
@wwwbruno
ABOUT ME
BRUNO ALMEIDA
Hometown @ Lages, Brazil
Ruby Engineer @ Event Inc
Go, Rails, Docker and Open Source lover
TOPICS
1. MVC on Rails
2. Clean Architecture
3. Rails code Examples
OBJECTIVE
Share experience with problem using Rails
“Architecture”
Show another point of view, that is also not
perfect
“What can I do better?”
INSPIRATION
UNCLE BOB
1. MVC
ON RAILS
WHAT IS RUBY ON RAILS?"Rails is a model–view–controller (MVC)
framework" Wikipedia
WHAT IS MVC?
TRYGVE REENSKAUG
WHAT IS WEB?
WEB IS ONLY A DETAIL
2. CLEAN
ARCHITECTURE
FRAMEWORKS AND DRIVERS
SMALL DETAILS LIKE DATABASE AND WEB
INTERFACE ADAPTERS
CONVERT DATA TO USE CASES AND EXTERNAL
AGENCIES
USE CASES
APPLICATION SPECIFIC RULES
ENTITIES
GENERAL AND HIGH LEVEL RULES
CROSS BOUNDARIES
DATA STRUCTURE
WHY USE CLEAN CODE
ARCHITECTURE?
DEPENDENCY
BETTER TO MAINTAIN, TEST, CHANGE, DEBUG…
HOW EASY IS TO CHANGE RAILS TO SINATRA?
AND FROM A CONTROLLER TO A SIDEKIQ JOB?
3. RAILS CODE
EXAMPLE
DISCLAIMER
SIMPLE TASK
- Create a user
- Validate name presence
- Validate email presence and uniqueness
- Send email after create
UsersController User WelcomeMailer
Validations
PO REQUEST
- Create user without sending email on Admin
- Send email to existent user on Admin
- Create user without password on Admin
UsersController User
WelcomeMailer
Validations
UsersController UserService
WelcomeMailer
Validations
User
LOOK FOR
RUBY MIDWEST 2011 - KEYNOTE:
ARCHITECTURE THE LOST YEARS BY
ROBERT MARTIN
LOOK FOR
THE CLEAN ARCHITECTURE
LOOK FOR
CLEAN ARCHITECTURE: A CRAFTSMAN'S GUIDE TO
SOFTWARE STRUCTURE AND DESIGN (ROBERT C.
MARTIN SERIES)
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

Mais conteúdo relacionado

Mais procurados

Backbone & React Together Forever
Backbone & React Together ForeverBackbone & React Together Forever
Backbone & React Together ForeverSamuel Breed
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlJoomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlPhilip Locke
 
Moore vs. May - everything is faster and better: we can fix that
Moore vs. May - everything is faster and better: we can fix thatMoore vs. May - everything is faster and better: we can fix that
Moore vs. May - everything is faster and better: we can fix thatChristian Heilmann
 
The State of the Web - Helsinki meetup
The State of the Web - Helsinki meetupThe State of the Web - Helsinki meetup
The State of the Web - Helsinki meetupChristian Heilmann
 
Get 900 + oneway links for Free
Get 900 + oneway links for FreeGet 900 + oneway links for Free
Get 900 + oneway links for Freeumerica76
 
The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)danwrong
 
Blogging In The Library Revised Oct 16
Blogging In The Library Revised Oct 16Blogging In The Library Revised Oct 16
Blogging In The Library Revised Oct 16bhodes
 
Word press beirut 23st meetup may
Word press beirut 23st meetup   mayWord press beirut 23st meetup   may
Word press beirut 23st meetup mayFadi Nicolas Zahhar
 
Websocket in iOS application to create real-time applications
Websocket in iOS application to create real-time applicationsWebsocket in iOS application to create real-time applications
Websocket in iOS application to create real-time applicationsRoman Barzyczak
 

Mais procurados (11)

Backbone & React Together Forever
Backbone & React Together ForeverBackbone & React Together Forever
Backbone & React Together Forever
 
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nlJoomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
Joomla wireframing Template - Joomladay Netherlands 2014 #jd14nl
 
Why Use Rails by Dr Nic
Why Use Rails by  Dr NicWhy Use Rails by  Dr Nic
Why Use Rails by Dr Nic
 
Moore vs. May - everything is faster and better: we can fix that
Moore vs. May - everything is faster and better: we can fix thatMoore vs. May - everything is faster and better: we can fix that
Moore vs. May - everything is faster and better: we can fix that
 
The State of the Web - Helsinki meetup
The State of the Web - Helsinki meetupThe State of the Web - Helsinki meetup
The State of the Web - Helsinki meetup
 
Get 900 + oneway links for Free
Get 900 + oneway links for FreeGet 900 + oneway links for Free
Get 900 + oneway links for Free
 
The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)The Mysteries Of JavaScript-Fu (@media SF Edition)
The Mysteries Of JavaScript-Fu (@media SF Edition)
 
Blogging In The Library Revised Oct 16
Blogging In The Library Revised Oct 16Blogging In The Library Revised Oct 16
Blogging In The Library Revised Oct 16
 
Selenium
SeleniumSelenium
Selenium
 
Word press beirut 23st meetup may
Word press beirut 23st meetup   mayWord press beirut 23st meetup   may
Word press beirut 23st meetup may
 
Websocket in iOS application to create real-time applications
Websocket in iOS application to create real-time applicationsWebsocket in iOS application to create real-time applications
Websocket in iOS application to create real-time applications
 

Semelhante a How to not create an unbreakable Rails monolith

Getting started with Ruby on Rails
Getting started with Ruby on RailsGetting started with Ruby on Rails
Getting started with Ruby on RailsRob Davarnia
 
A Tour of Ruby On Rails
A Tour of Ruby On RailsA Tour of Ruby On Rails
A Tour of Ruby On RailsDavid Keener
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails newPaul Oguda
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsDonSchado
 
Frontend 'vs' Backend Getting the Right Mix
Frontend 'vs' Backend   Getting the Right MixFrontend 'vs' Backend   Getting the Right Mix
Frontend 'vs' Backend Getting the Right MixBob Paulin
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentFariha Tasnim
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentFariha Tasnim
 
Model View Madness
Model View MadnessModel View Madness
Model View MadnessMike Wilcox
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLê Thưởng
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web DevelopmentSonia Simi
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introductionTania Gonzales
 
Angular js introduction by Tania Gonzales
Angular js introduction by Tania GonzalesAngular js introduction by Tania Gonzales
Angular js introduction by Tania GonzalesThoughtworks
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentationMaslowB
 
Why you should use a web framework, eventually
Why you should use a web framework, eventuallyWhy you should use a web framework, eventually
Why you should use a web framework, eventuallykyphpug
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Railsmithunsasidharan
 
Dot net-course-curriculumn
Dot net-course-curriculumnDot net-course-curriculumn
Dot net-course-curriculumnAmit Sharma
 

Semelhante a How to not create an unbreakable Rails monolith (20)

Getting started with Ruby on Rails
Getting started with Ruby on RailsGetting started with Ruby on Rails
Getting started with Ruby on Rails
 
A Tour of Ruby On Rails
A Tour of Ruby On RailsA Tour of Ruby On Rails
A Tour of Ruby On Rails
 
Mvc3 part1
Mvc3   part1Mvc3   part1
Mvc3 part1
 
Beyond rails new
Beyond rails newBeyond rails new
Beyond rails new
 
Asp.netmvc handson
Asp.netmvc handsonAsp.netmvc handson
Asp.netmvc handson
 
Rails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on RailsRails Girls: Programming, Web Applications and Ruby on Rails
Rails Girls: Programming, Web Applications and Ruby on Rails
 
Learning Rails
Learning RailsLearning Rails
Learning Rails
 
Frontend 'vs' Backend Getting the Right Mix
Frontend 'vs' Backend   Getting the Right MixFrontend 'vs' Backend   Getting the Right Mix
Frontend 'vs' Backend Getting the Right Mix
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
Model View Madness
Model View MadnessModel View Madness
Model View Madness
 
Lecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdfLecture 05 - Creating a website with Razor Pages.pdf
Lecture 05 - Creating a website with Razor Pages.pdf
 
Ruby Rails Web Development
Ruby Rails Web DevelopmentRuby Rails Web Development
Ruby Rails Web Development
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
Angular js introduction by Tania Gonzales
Angular js introduction by Tania GonzalesAngular js introduction by Tania Gonzales
Angular js introduction by Tania Gonzales
 
Aspnet mvc
Aspnet mvcAspnet mvc
Aspnet mvc
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
 
Why you should use a web framework, eventually
Why you should use a web framework, eventuallyWhy you should use a web framework, eventually
Why you should use a web framework, eventually
 
Introduction to Ruby on Rails
Introduction to Ruby on RailsIntroduction to Ruby on Rails
Introduction to Ruby on Rails
 
Dot net-course-curriculumn
Dot net-course-curriculumnDot net-course-curriculumn
Dot net-course-curriculumn
 

Mais de Bruno Almeida

How to not make your Rails application in a huge monolith
How to not make your Rails application in a huge monolithHow to not make your Rails application in a huge monolith
How to not make your Rails application in a huge monolithBruno Almeida
 
Golang - Why is so fun?
Golang - Why is so fun?Golang - Why is so fun?
Golang - Why is so fun?Bruno Almeida
 
Git - Workshop Disruptiva
Git - Workshop DisruptivaGit - Workshop Disruptiva
Git - Workshop DisruptivaBruno Almeida
 
Understanding form helpers
Understanding form helpersUnderstanding form helpers
Understanding form helpersBruno Almeida
 

Mais de Bruno Almeida (6)

How to not make your Rails application in a huge monolith
How to not make your Rails application in a huge monolithHow to not make your Rails application in a huge monolith
How to not make your Rails application in a huge monolith
 
Golang - Why is so fun?
Golang - Why is so fun?Golang - Why is so fun?
Golang - Why is so fun?
 
From zero to git
From zero to gitFrom zero to git
From zero to git
 
Git - Workshop Disruptiva
Git - Workshop DisruptivaGit - Workshop Disruptiva
Git - Workshop Disruptiva
 
Understanding form helpers
Understanding form helpersUnderstanding form helpers
Understanding form helpers
 
Git para inciantes
Git para inciantesGit para inciantes
Git para inciantes
 

Último

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Paola De la Torre
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 

Último (20)

Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101Salesforce Community Group Quito, Salesforce 101
Salesforce Community Group Quito, Salesforce 101
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 

How to not create an unbreakable Rails monolith