SlideShare ist ein Scribd-Unternehmen logo
1 von 43
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

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
bhodes
 

Was ist angesagt? (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
 

Ähnlich wie 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 Rails
Rob Davarnia
 
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
Lê Thưởng
 
Mvc presentation
Mvc presentationMvc presentation
Mvc presentation
MaslowB
 

Ähnlich wie 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
 
Angular js introduction by Tania Gonzales
Angular js introduction by Tania GonzalesAngular js introduction by Tania Gonzales
Angular js introduction by Tania Gonzales
 
AngularJS introduction
AngularJS introductionAngularJS introduction
AngularJS introduction
 
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
 

Mehr von 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
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Kürzlich hochgeladen (20)

Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 

How to not create an unbreakable Rails monolith