SlideShare a Scribd company logo
1 of 48
Download to read offline
Rails advantages and
     techniques
Person.find_by_name ‘Jan’
• Jan ‘DefV’ De Poorter
• Developer, IT Engineer
• Openminds, #1 Rails Hoster in .be
• blog.defv.be
• Trying to be first on google as Jan
Ruby on Rails
Ruby on Rails
 it does scale
• Framework based on Ruby
• Fast, agile development
• www.rubyonrails.com
So... Why ?
“I already know PHP/.NET/...”
Fast Development
• CRUD
• Scaffolding (if you really need to)
• DRY
• AJAX
• acts_as_something
Maintainable
• Very readable code
• Implemented documentation system (RDOC)
• Tests makes sure you don’t break anything
Model View Controller
Model View Controller
• Interface to the database
• Business Logic goes here
• For the DataBase Admin
   class User < ActiveRecord::Base
     has_many :tasks
   end

   class Task < ActiveRecord::Base
     belongs_to :user
   end
Model View Controller
• Link between DB (model) and User (view)
• HTTP / Sessions / Cookies / Post / Get
• For the Developer
  class TaskController < ApplicationController
    def index
      @tasks = User.find(session[:user_id]).tasks
    end
  end
Model View Controller
• Web Interface
• What the client sees
• For the Designer
   ...
   <body>
   <% @tasks.each do |task| %>
     <div class=’task’>
       <%= task.content %> is <%= task.status %>
     </div>
   <% end %>
   </body>
Testing
Test-Driven Development
Test-Driven Development
• Write tests first
Test-Driven Development
• Write tests first
• FAIL
Test-Driven Development
• Write tests first
• FAIL
• Implement
Test-Driven Development
• Write tests first
• FAIL
• Implement
• SUCCEED
Test-Driven Development
• Write tests first
• FAIL
• Implement
• SUCCEED
• Clean Up
Test-Driven Development
• Write tests first
• FAIL
• Implement
• SUCCEED
• Clean Up
• Check-In to Version Management
that seems more work?
no
no (but..)
• No, because
  •   No more broken builds

  •   Fix bugs forever

  •   Think before you implement

  •   Small steps


• Yes, because
 • it takes time to learn
Not only for developers!
def test_if_layout_elements_are_present
 assert_select “body” do
   assert_select “div.task”, :count => 3 do
    assert_select “ul” do
      assert_select “li”, :count => 3
    end
   end
 end
end
is that all ?
No!
polymorphism




               No!
polymorphism
               20.minutes.ago




                    No!
polymorphism
               20.minutes.ago



1.gigabyte
                    No!
polymorphism
               20.minutes.ago



1.gigabyte
                    No!

                 time_ago_in_words
polymorphism
               20.minutes.ago



1.gigabyte
                    No!
   prototype

                 time_ago_in_words
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many

1.gigabyte
                    No!
   prototype

                 time_ago_in_words
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many

1.gigabyte
                    No!
                                 cache
   prototype

                 time_ago_in_words
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many

1.gigabyte
                    No!              routes


                                 cache
   prototype

                 time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many

1.gigabyte
                    No!                  routes


                                     cache
   prototype

                 time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many
  <%= debug object %>
1.gigabyte
                    No!                  routes


                                     cache
   prototype

                 time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many
  <%= debug object %>
1.gigabyte
                    No!                  routes


                                     cache
   prototype
       delegate time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many
  <%= debug object %>
1.gigabyte
                    No!                  routes


                    group_by         cache
   prototype
       delegate time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many
  <%= debug object %>
1.gigabyte
                    No!                  routes
 find_by_sql
                    group_by         cache
   prototype
       delegate time_ago_in_words
link_to_remote
polymorphism
               20.minutes.ago
                         has_and_belongs_to_many
  <%= debug object %>
1.gigabyte                        REST
                    No!                  routes
 find_by_sql
                    group_by         cache
   prototype
       delegate time_ago_in_words
titleize     link_to_remote
polymorphism
               20.minutes.ago
                          has_and_belongs_to_many
  <%= debug object %>
1.gigabyte                        REST
                    No!                  routes
 find_by_sql
                    group_by         cache
   prototype
       delegate time_ago_in_words
titleize     link_to_remote
polymorphism
               20.minutes.ago
                             has_and_belongs_to_many
  <%= debug object %>
1.gigabyte                        REST
                    No!                  routes
                       ...
 find_by_sql
                    group_by         cache
   prototype
       delegate time_ago_in_words
Q &A
   Examples?
   Discussion

   Thank you for listening
Jan De Poorter - Openminds

More Related Content

Similar to Rails advantages and techniques

Javascript orientado a testes
Javascript orientado a testesJavascript orientado a testes
Javascript orientado a testes
Alexandre Gomes
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
Fred Sauer
 
Socket applications
Socket applicationsSocket applications
Socket applications
João Moura
 

Similar to Rails advantages and techniques (20)

MariaDB Replication manager and HAProxy (HAProxy Paris Meetup)
MariaDB Replication manager and HAProxy (HAProxy Paris Meetup)MariaDB Replication manager and HAProxy (HAProxy Paris Meetup)
MariaDB Replication manager and HAProxy (HAProxy Paris Meetup)
 
Audit your reactive applications
Audit your reactive applicationsAudit your reactive applications
Audit your reactive applications
 
Some Rough Fibrous Material
Some Rough Fibrous MaterialSome Rough Fibrous Material
Some Rough Fibrous Material
 
Php resque
Php resquePhp resque
Php resque
 
Test First Teaching
Test First TeachingTest First Teaching
Test First Teaching
 
ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4ApacheCon 2014 - What's New in Apache httpd 2.4
ApacheCon 2014 - What's New in Apache httpd 2.4
 
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com RubyConsegi 2010 - Dicas de Desenvolvimento Web com Ruby
Consegi 2010 - Dicas de Desenvolvimento Web com Ruby
 
ZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small TeamsZendCon 2015 - DevOps for Small Teams
ZendCon 2015 - DevOps for Small Teams
 
Monkeybars in the Manor
Monkeybars in the ManorMonkeybars in the Manor
Monkeybars in the Manor
 
Madison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small TeamsMadison PHP 2015 - DevOps For Small Teams
Madison PHP 2015 - DevOps For Small Teams
 
Celery: The Distributed Task Queue
Celery: The Distributed Task QueueCelery: The Distributed Task Queue
Celery: The Distributed Task Queue
 
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
J1 2015 "Debugging Java Apps in Containers: No Heavy Welding Gear Required"
 
Javascript orientado a testes
Javascript orientado a testesJavascript orientado a testes
Javascript orientado a testes
 
Northeast PHP - High Performance PHP
Northeast PHP - High Performance PHPNortheast PHP - High Performance PHP
Northeast PHP - High Performance PHP
 
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
SF JUG - GWT Can Help You Create Amazing Apps - 2009-10-13
 
Design Summit - Migrating to Ruby 2 - Joe Rafaniello
Design Summit - Migrating to Ruby 2 - Joe RafanielloDesign Summit - Migrating to Ruby 2 - Joe Rafaniello
Design Summit - Migrating to Ruby 2 - Joe Rafaniello
 
Alfresco DevCon 2019 Performance Tools of the Trade
Alfresco DevCon 2019   Performance Tools of the TradeAlfresco DevCon 2019   Performance Tools of the Trade
Alfresco DevCon 2019 Performance Tools of the Trade
 
Day 2 - Intro to Rails
Day 2 - Intro to RailsDay 2 - Intro to Rails
Day 2 - Intro to Rails
 
Socket applications
Socket applicationsSocket applications
Socket applications
 
Nodejs Performance Debug
Nodejs Performance DebugNodejs Performance Debug
Nodejs Performance Debug
 

Recently uploaded

Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
lizamodels9
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
lizamodels9
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
amitlee9823
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
Abortion pills in Kuwait Cytotec pills in Kuwait
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
Matteo Carbone
 

Recently uploaded (20)

Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Cracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptxCracking the Cultural Competence Code.pptx
Cracking the Cultural Competence Code.pptx
 
Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
Enhancing and Restoring Safety & Quality Cultures - Dave Litwiller - May 2024...
 
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
Russian Call Girls In Gurgaon ❤️8448577510 ⊹Best Escorts Service In 24/7 Delh...
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best ServicesMysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
Mysore Call Girls 8617370543 WhatsApp Number 24x7 Best Services
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
Call Girls In DLf Gurgaon ➥99902@11544 ( Best price)100% Genuine Escort In 24...
 
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRLMONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
MONA 98765-12871 CALL GIRLS IN LUDHIANA LUDHIANA CALL GIRL
 
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
The Path to Product Excellence: Avoiding Common Pitfalls and Enhancing Commun...
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 
RSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors DataRSA Conference Exhibitor List 2024 - Exhibitors Data
RSA Conference Exhibitor List 2024 - Exhibitors Data
 
Business Model Canvas (BMC)- A new venture concept
Business Model Canvas (BMC)-  A new venture conceptBusiness Model Canvas (BMC)-  A new venture concept
Business Model Canvas (BMC)- A new venture concept
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
VVVIP Call Girls In Greater Kailash ➡️ Delhi ➡️ 9999965857 🚀 No Advance 24HRS...
 
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabiunwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
unwanted pregnancy Kit [+918133066128] Abortion Pills IN Dubai UAE Abudhabi
 
John Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdfJohn Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdf
 
Insurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usageInsurers' journeys to build a mastery in the IoT usage
Insurers' journeys to build a mastery in the IoT usage
 

Rails advantages and techniques