SlideShare a Scribd company logo
1 of 18
Download to read offline
Ruby on Rails
From simplicity to complexity
07/03/2014 - Presentation for le Wagon
Ruby on Rails
From simplicity to complexity
Going to production
Scaling
Bootstrapping
If we were to start over with Copass,
what are the good choices we’d keep and the lessons we’d learn?
Bootstrapping
Bootstrapping
★ Database: PostgreSQL
★ Front-End: Bootstrap, jQuery
★ Precompiled languages: Haml,
Coffeescript, SASS, Markdown
★ Debugging: Better Errors
★ Authentication: Devise
★ Version Control: Git, Github (of course)
★ Support: Stackoverflow (of course)
★ REST structure
★ MVC structure
★ Ruby tricks
★ Don’t use DB-related gems
★ Multi-steps signup
★ Avoid front-end gems
★ Name things
LESSONS LEARNEDGOOD CHOICES
Markdown http://en.wikipedia.org/wiki/Markdown
❖ Markdown allows you to write using an easy-to-read, easy-to-write
plain text format, then convert it to structurally valid XHTML (or HTML).
❖ Allows to separate
content from logic !
Anyone can edit
markdown documents
❖ Used by Github,
Stackoverflow etc.
Markdown 3 steps
Better Errors gem https://github.com/charliesome/better_errors
❖ Best tool for debugging
❖ Displays a live console in your browser
❖ Allows you to:
+ see the content of variables
+ see the source code where
the bug occured
+ includes gem related code
Better error interface
REST Structure http://en.wikipedia.org/wiki/Representational_state_transfer
❖ Heard of those GET, POST, PUT, DELETE http methods?
❖ Respect the basics:
➢ GET : fetches one/many objects, doesn’t change any value (read only)
➢ POST : creates an object
➢ PUT : edit an object
➢ DELETE : delete an object
❖ Advantages:
➢ Use the convention among the team
➢ Keeps you router clean
➢ Prevents pages refresh from doing several tie the same action
➢ Good API design
Don’t use DB related gem
❖ We all use many gems to bootstrap faster
❖ Don’t use them when they are database related
❖ Eg. Friendships managed with Amistad
➢ Cool, I have a whole set of methods ready (add friend, remove friend, get
friends, get pending requests etc.)
➢ But I need to add a notification level on each friend
➢ And also some friend suggestions
➢ Errr…. you can’t because it is a gem
➢ Hence double data size, harder management etc.
If you really want this gem,
you can either copy paste
its code into your project,
or fork it straight away and
customize it as you need as
if it were your proper code!
Going to production
LESSONS LEARNED
Going to production
★ Hosting: Heroku + S3
★ Backups: PGBackups Archive
★ Deployment: Deploy Hooks
★ Spam prevention: Negative
Captcha
★ Maintenance: Exception
Notification, Dead Man Snitch
★ Use Paperclip as a service
★ Testing becomes necessary at
this step
GOOD CHOICES
Negative Captcha https://github.com/subwindow/negative-captcha
❖ In production, every public form is subject to spam
❖ But Captchas are boring, time consuming, as a user, you’d feel
frustrated, untrusted
❖ Someone invented negative captcha:
❖ Add a fake field that will be filled by robots
but not humans
❖ User experience is the same !
Name
Email
Form
Hidden fieldOk
Filled by Robots not
humans
Scaling
LESSONS LEARNED
Scaling
★ Web server: Phusion Passenger
★ CDN: Cloudfront
★ Background jobs: Delayed Job +
Workless
★ Database Indexes
★ Memory usage
★ To test: Dynosaur
GOOD CHOICES
Workless https://github.com/lostboy/workless
❖ Based on delayed jobs : sends tasks to the background by adding .
delay
➢ Eg.
❖ But for background jobs, you need a Heroku worker which costs
money
❖ The awesomeness of workless is that the worker is automatically
scaled up when there are tasks in the queue, and down when it is over
➢ No extra fees!
def generate_sizes_async(erase= false)
self.delay.generate_sizes(erase)
end
Next steps
❖ More front end logic
➢ Angular
❖ Going Mobile, how?
➢ Ruby Motion ( ), Responsive web design, native app with strong
API
Going mobile
Tips and reads
❖ Subscribe to RubyWeekly newsletter
❖ Very good articles:
➔ How to get More Bang for your Heroku Buck While Making Your Rails Site Super Snappy
➔ An Introduction To DOM Events
➔ A basic guide to when and how to deploy HTTPS
➔ What every web developer must know about URL encoding
➔ Ruby Styleguide
➔ Github flow
?
Thanks !
Augustin Riedinger
augustin@copass.org
http://copass.org

More Related Content

What's hot

Modern frontend workflow
Modern frontend workflowModern frontend workflow
Modern frontend workflow
Revath S Kumar
 
Angular – Say Goodbye to Javascript Soup
Angular – Say Goodbye to Javascript SoupAngular – Say Goodbye to Javascript Soup
Angular – Say Goodbye to Javascript Soup
Graeme Foster
 
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Ezra Gildesgame
 
Welcome to level 2 partial
Welcome to level 2 partialWelcome to level 2 partial
Welcome to level 2 partial
Edwin Loján
 

What's hot (20)

Build the mobile web you want
Build the mobile web you wantBuild the mobile web you want
Build the mobile web you want
 
Web performance: crafts of internet age
Web performance: crafts of internet ageWeb performance: crafts of internet age
Web performance: crafts of internet age
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015
 
Web Assembly (W3C TPAC presentation)
Web Assembly (W3C TPAC presentation)Web Assembly (W3C TPAC presentation)
Web Assembly (W3C TPAC presentation)
 
Ruby course-1-practice
Ruby course-1-practiceRuby course-1-practice
Ruby course-1-practice
 
Javascript Frameworks Comparison
Javascript Frameworks ComparisonJavascript Frameworks Comparison
Javascript Frameworks Comparison
 
Modern frontend workflow
Modern frontend workflowModern frontend workflow
Modern frontend workflow
 
Life in the Fast Lane: Speed, Usability & Search Engine Optimization
Life in the Fast Lane: Speed, Usability & Search Engine OptimizationLife in the Fast Lane: Speed, Usability & Search Engine Optimization
Life in the Fast Lane: Speed, Usability & Search Engine Optimization
 
Intro to react_v2
Intro to react_v2Intro to react_v2
Intro to react_v2
 
Web assembly - Future of the Web
Web assembly - Future of the WebWeb assembly - Future of the Web
Web assembly - Future of the Web
 
Angular – Say Goodbye to Javascript Soup
Angular – Say Goodbye to Javascript SoupAngular – Say Goodbye to Javascript Soup
Angular – Say Goodbye to Javascript Soup
 
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
Understanding XHProf: Pinpointing Why Your Site is Slow and How to Fix it - S...
 
Welcome to level 2 partial
Welcome to level 2 partialWelcome to level 2 partial
Welcome to level 2 partial
 
The Dawson Way of Doing Things: A Study of Our Path Using WordPress
The Dawson Way of Doing Things: A Study of Our Path Using WordPressThe Dawson Way of Doing Things: A Study of Our Path Using WordPress
The Dawson Way of Doing Things: A Study of Our Path Using WordPress
 
WordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress WebappsWordCamp 2012 - WordPress Webapps
WordCamp 2012 - WordPress Webapps
 
All the small things… - Awwwards 2016
All the small things… - Awwwards 2016All the small things… - Awwwards 2016
All the small things… - Awwwards 2016
 
Ember
EmberEmber
Ember
 
WebAssembly Overview
WebAssembly OverviewWebAssembly Overview
WebAssembly Overview
 
Welcome to level 22038
Welcome to level 22038Welcome to level 22038
Welcome to level 22038
 
Web dev syllabus
Web dev syllabusWeb dev syllabus
Web dev syllabus
 

Similar to Copass + Ruby on Rails = <3 - From Simplicity to Complexity

Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...
boxuno
 
English Casual 2012/05/10
English Casual 2012/05/10English Casual 2012/05/10
English Casual 2012/05/10
Ryosuke IWANAGA
 
Responsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJSResponsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJS
Christian Heilmann
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
dotCloud
 
[Mas 500] Web Basics
[Mas 500] Web Basics[Mas 500] Web Basics
[Mas 500] Web Basics
rahulbot
 
[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies
rahulbot
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
Docker, Inc.
 

Similar to Copass + Ruby on Rails = <3 - From Simplicity to Complexity (20)

Dapper: the microORM that will change your life
Dapper: the microORM that will change your lifeDapper: the microORM that will change your life
Dapper: the microORM that will change your life
 
Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...Should you use HTML5 to build your product? The pros & cons of using current ...
Should you use HTML5 to build your product? The pros & cons of using current ...
 
Message Queues in Ruby - An Overview
Message Queues in Ruby - An OverviewMessage Queues in Ruby - An Overview
Message Queues in Ruby - An Overview
 
Let’s be productive with spring boot
Let’s be productive with spring bootLet’s be productive with spring boot
Let’s be productive with spring boot
 
Txjs
TxjsTxjs
Txjs
 
English Casual 2012/05/10
English Casual 2012/05/10English Casual 2012/05/10
English Casual 2012/05/10
 
Responsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJSResponsive, adaptive and responsible - keynote at NebraskaJS
Responsive, adaptive and responsible - keynote at NebraskaJS
 
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
Sailor - A web MVC framework in Lua by Etiene Dalcol (Lua Workshop 2014)
 
Midwest php 2013 deploying php on paas- why & how
Midwest php 2013   deploying php on paas- why & howMidwest php 2013   deploying php on paas- why & how
Midwest php 2013 deploying php on paas- why & how
 
12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL12-Step Program for Scaling Web Applications on PostgreSQL
12-Step Program for Scaling Web Applications on PostgreSQL
 
Super lazy side projects - Hamik Mukelyan
Super lazy side projects - Hamik MukelyanSuper lazy side projects - Hamik Mukelyan
Super lazy side projects - Hamik Mukelyan
 
Lessons From A DevOps Transformation on AWS
Lessons From A DevOps Transformation on AWSLessons From A DevOps Transformation on AWS
Lessons From A DevOps Transformation on AWS
 
Devops For Drupal
Devops  For DrupalDevops  For Drupal
Devops For Drupal
 
[Mas 500] Web Basics
[Mas 500] Web Basics[Mas 500] Web Basics
[Mas 500] Web Basics
 
Mobile native-hacks
Mobile native-hacksMobile native-hacks
Mobile native-hacks
 
[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies[Mas 500] Software Development Strategies
[Mas 500] Software Development Strategies
 
Android development war stories
Android development war storiesAndroid development war stories
Android development war stories
 
Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?Deploying PHP on PaaS: Why and How?
Deploying PHP on PaaS: Why and How?
 
Visual Regression Testing: In search of an Ember solution
Visual Regression Testing: In search of an Ember solutionVisual Regression Testing: In search of an Ember solution
Visual Regression Testing: In search of an Ember solution
 
The JavaScript Delusion
The JavaScript DelusionThe JavaScript Delusion
The JavaScript Delusion
 

Recently uploaded

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
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
giselly40
 

Recently uploaded (20)

EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
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
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
[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
 
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
 
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 Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
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
 

Copass + Ruby on Rails = <3 - From Simplicity to Complexity

  • 1. Ruby on Rails From simplicity to complexity 07/03/2014 - Presentation for le Wagon
  • 2. Ruby on Rails From simplicity to complexity Going to production Scaling Bootstrapping If we were to start over with Copass, what are the good choices we’d keep and the lessons we’d learn?
  • 4. Bootstrapping ★ Database: PostgreSQL ★ Front-End: Bootstrap, jQuery ★ Precompiled languages: Haml, Coffeescript, SASS, Markdown ★ Debugging: Better Errors ★ Authentication: Devise ★ Version Control: Git, Github (of course) ★ Support: Stackoverflow (of course) ★ REST structure ★ MVC structure ★ Ruby tricks ★ Don’t use DB-related gems ★ Multi-steps signup ★ Avoid front-end gems ★ Name things LESSONS LEARNEDGOOD CHOICES
  • 5. Markdown http://en.wikipedia.org/wiki/Markdown ❖ Markdown allows you to write using an easy-to-read, easy-to-write plain text format, then convert it to structurally valid XHTML (or HTML). ❖ Allows to separate content from logic ! Anyone can edit markdown documents ❖ Used by Github, Stackoverflow etc. Markdown 3 steps
  • 6. Better Errors gem https://github.com/charliesome/better_errors ❖ Best tool for debugging ❖ Displays a live console in your browser ❖ Allows you to: + see the content of variables + see the source code where the bug occured + includes gem related code Better error interface
  • 7. REST Structure http://en.wikipedia.org/wiki/Representational_state_transfer ❖ Heard of those GET, POST, PUT, DELETE http methods? ❖ Respect the basics: ➢ GET : fetches one/many objects, doesn’t change any value (read only) ➢ POST : creates an object ➢ PUT : edit an object ➢ DELETE : delete an object ❖ Advantages: ➢ Use the convention among the team ➢ Keeps you router clean ➢ Prevents pages refresh from doing several tie the same action ➢ Good API design
  • 8. Don’t use DB related gem ❖ We all use many gems to bootstrap faster ❖ Don’t use them when they are database related ❖ Eg. Friendships managed with Amistad ➢ Cool, I have a whole set of methods ready (add friend, remove friend, get friends, get pending requests etc.) ➢ But I need to add a notification level on each friend ➢ And also some friend suggestions ➢ Errr…. you can’t because it is a gem ➢ Hence double data size, harder management etc. If you really want this gem, you can either copy paste its code into your project, or fork it straight away and customize it as you need as if it were your proper code!
  • 10. LESSONS LEARNED Going to production ★ Hosting: Heroku + S3 ★ Backups: PGBackups Archive ★ Deployment: Deploy Hooks ★ Spam prevention: Negative Captcha ★ Maintenance: Exception Notification, Dead Man Snitch ★ Use Paperclip as a service ★ Testing becomes necessary at this step GOOD CHOICES
  • 11. Negative Captcha https://github.com/subwindow/negative-captcha ❖ In production, every public form is subject to spam ❖ But Captchas are boring, time consuming, as a user, you’d feel frustrated, untrusted ❖ Someone invented negative captcha: ❖ Add a fake field that will be filled by robots but not humans ❖ User experience is the same ! Name Email Form Hidden fieldOk Filled by Robots not humans
  • 13. LESSONS LEARNED Scaling ★ Web server: Phusion Passenger ★ CDN: Cloudfront ★ Background jobs: Delayed Job + Workless ★ Database Indexes ★ Memory usage ★ To test: Dynosaur GOOD CHOICES
  • 14. Workless https://github.com/lostboy/workless ❖ Based on delayed jobs : sends tasks to the background by adding . delay ➢ Eg. ❖ But for background jobs, you need a Heroku worker which costs money ❖ The awesomeness of workless is that the worker is automatically scaled up when there are tasks in the queue, and down when it is over ➢ No extra fees! def generate_sizes_async(erase= false) self.delay.generate_sizes(erase) end
  • 15. Next steps ❖ More front end logic ➢ Angular ❖ Going Mobile, how? ➢ Ruby Motion ( ), Responsive web design, native app with strong API Going mobile
  • 16. Tips and reads ❖ Subscribe to RubyWeekly newsletter ❖ Very good articles: ➔ How to get More Bang for your Heroku Buck While Making Your Rails Site Super Snappy ➔ An Introduction To DOM Events ➔ A basic guide to when and how to deploy HTTPS ➔ What every web developer must know about URL encoding ➔ Ruby Styleguide ➔ Github flow