Ruby on Rails

Wednesday, March 18, 2009
AkitaOnRails.com




               www.slideshare.net/akitaonrails

Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
1
Wednesday, March 18, 2009
Joel Spolsky




Wednesday, March 18, 2009
Wednesday, March 18, 2009
“Without understanding functional programming, you can't
             invent MapReduce, the algorithm that makes Google so...
“The terms Map and Reduce come from Lisp and
                                functional programming...”




         “The ...
“The very fact that Google invented MapReduce, and
           Microsoft didn't, says something about why Microsoft is stil...
Codificadores
                             x
                      Desenvolvedores


Wednesday, March 18, 2009
Qual foi o concurso?


                            Qual foi o prêmio?



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Martin Fowler




Wednesday, March 18, 2009
Agile




Wednesday, March 18, 2009
AGILIDADE



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Estamos “descobrindo” maneiras melhores
                       de desenvolver software na prática e ajudando
             ...
Wednesday, March 18, 2009
Big Design Up Front


                            “Waterfall” (Cascata)


                              Escopo Fechado


 ...
Big Design Up Front


                            “Waterfall” (Cascata)


                              Escopo Fechado


 ...
Big Design Up Front


                            “Waterfall” (Cascata)


                              Escopo Fechado


 ...
Big Design Up Front


                            “Waterfall” (Cascata)


                              Escopo Fechado


 ...
Wednesday, March 18, 2009
Ceticismo



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Winston W. Royce - 1970
Wednesday, March 18, 2009
“Eu acredito neste conceito
                                       mas a implementação descrita
                          ...
“Eu acredito neste conceito
                                       mas a implementação descrita
                          ...
“Eu acredito neste conceito
                                       mas a implementação descrita
                          ...
“Cargo Cult”

Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
“SOFT”WARE



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
1
Wednesday, March 18, 2009
2
Wednesday, March 18, 2009
“Matz”




                            1993
Wednesday, March 18, 2009
“Prag Dave”




                             2001
Wednesday, March 18, 2009
“DHH”


                             2004
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
“Tornar as coisas simples
                      fáceis e as coisas
                    complexas possíveis”
              ...
Wednesday, March 18, 2009
Ruby on Rails



Wednesday, March 18, 2009
RUBY

Wednesday, March 18, 2009
ActiveSupport
                            Rails


                                    RUBY

Wednesday, March 18, 2009
ActionController
                            ActionPack
                                                  ActionView


   ...
ActiveRecord
                                                  ActionController
                              ActionPack
 ...
ActionMailer
                            ActiveRecord
                                                  ActionController
 ...
ActiveResource          ActionWebService


                                                      ActionMailer
            ...
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
RSpec

      describe Product do
        include ProductSpecHelper

           before(:each) do
             @product = Pr...
RSpec

      describe Product do
        include ProductSpecHelper

           before(:each) do
             @product = Pr...
Model

   class Product < ActiveRecord::Base
     after_create :set_initial_inventory

        has_many :variants, :depend...
Model

   class Product < ActiveRecord::Base
     after_create :set_initial_inventory

        has_many :variants, :depend...
Controller


     class UsersController < Spree::BaseController
       resource_controller
       before_filter :initializ...
Controller


     class UsersController < Spree::BaseController
       resource_controller
       before_filter :initializ...
Views ERB

   <div id=quot;product-listingquot;>
     <%= breadcrumbs(@taxon) %>
     <br/>
     <%= render :partial => qu...
Views HAML


       #product-listing
         =breadcrumbs(@taxon)
         %br
         =render :partial => quot;shared/p...
Rotas RESTFul



   ActionController::Routing::Routes.draw do |map|
     map.connect ':controller/service.wsdl', :action =...
Rotas RESTFul



                    GET /products/new
   ActionController::Routing::Routes.draw do |map|
     map.connect...
Migrations



          class RenameAppConfiguration < ActiveRecord::Migration
            def self.up
              renam...
Migrations



          class RenameAppConfiguration < ActiveRecord::Migration
            def self.up
              renam...
“Beautiful Code”



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
11 mil classes!

                              46 só de
                             Collections!



Wednesday, March 18, ...
• Classes:
                            • Modules:       • Array
                             • Enumerable    • Hash
      ...
1.400 Classes:
                                          •
                                     classesArray
             ...
• Convention over Configuration
       • Don’t Repeat Yourself
       • You Ain’t Gonna Need It
       • Boas Práticas
    ...
2
Wednesday, March 18, 2009
3
Wednesday, March 18, 2009
Mitos



Wednesday, March 18, 2009
Rails não Escala



Wednesday, March 18, 2009
Wednesday, March 18, 2009
To put things into perspective,
        though, Friendster was written
       in Java to start, and switched to
         P...
“The New York Times used Ruby on Rails to pull
                 together, analyze and display election results in near
   ...
“They serve up 23 million visitors a month. The conversion resulted in 20,000 lines of Ruby
               code instead of...
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Mitos



Wednesday, March 18, 2009
Deployment de
                             Rails é difícil


Wednesday, March 18, 2009
Wednesday, March 18, 2009
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Apache + FastCGI

                            LightTPD + FastCGI

                             Litespeed + SAPI

         ...
Wednesday, March 18, 2009
gem install passenger
                 passenger-install-apache2-module




Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Mitos



Wednesday, March 18, 2009
Rails é mal
                            documentado


Wednesday, March 18, 2009
Geoffrey
Wednesday, March 18, 2009
Jason e Gregg
Wednesday, March 18, 2009
Pratik Naik
Wednesday, March 18, 2009
Satish Talim
Wednesday, March 18, 2009
Peter Cooper
Wednesday, March 18, 2009
_why
Wednesday, March 18, 2009
Ryan Bates
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
3
Wednesday, March 18, 2009
4
Wednesday, March 18, 2009
Open Source



Wednesday, March 18, 2009
Chris Wanstrath
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Conferências



Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
Wednesday, March 18, 2009
4
Wednesday, March 18, 2009
One more thing ...



Wednesday, March 18, 2009
Wednesday, March 18, 2009
“Especialista de
                uma coisa só é um
                amador em todo o
                     resto.”

Wednesda...
Obrigado!
                            www.akitaonrails.com

Wednesday, March 18, 2009
Upcoming SlideShare
Loading in...5
×

Web Expo Forum

3,922
-1

Published on

Palestra introdutória de Rails e de filosofia de desenvolvimento de software.

Published in: Technology
0 Comments
3 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
3,922
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
25
Comments
0
Likes
3
Embeds 0
No embeds

No notes for slide

Web Expo Forum

  1. 1. Ruby on Rails Wednesday, March 18, 2009
  2. 2. AkitaOnRails.com www.slideshare.net/akitaonrails Wednesday, March 18, 2009
  3. 3. Wednesday, March 18, 2009
  4. 4. Wednesday, March 18, 2009
  5. 5. 1 Wednesday, March 18, 2009
  6. 6. Joel Spolsky Wednesday, March 18, 2009
  7. 7. Wednesday, March 18, 2009
  8. 8. “Without understanding functional programming, you can't invent MapReduce, the algorithm that makes Google so massively scalable.” “The Perils of JavaSchools” - Joel Spolsky - 29/12/2005 http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html Wednesday, March 18, 2009
  9. 9. “The terms Map and Reduce come from Lisp and functional programming...” “The Perils of JavaSchools” - Joel Spolsky - 29/12/2005 http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html Wednesday, March 18, 2009
  10. 10. “The very fact that Google invented MapReduce, and Microsoft didn't, says something about why Microsoft is still playing catch up.” “The Perils of JavaSchools” - Joel Spolsky - 29/12/2005 http://www.joelonsoftware.com/articles/ThePerilsofJavaSchools.html Wednesday, March 18, 2009
  11. 11. Codificadores x Desenvolvedores Wednesday, March 18, 2009
  12. 12. Qual foi o concurso? Qual foi o prêmio? Wednesday, March 18, 2009
  13. 13. Wednesday, March 18, 2009
  14. 14. Wednesday, March 18, 2009
  15. 15. Wednesday, March 18, 2009
  16. 16. Wednesday, March 18, 2009
  17. 17. Wednesday, March 18, 2009
  18. 18. Martin Fowler Wednesday, March 18, 2009
  19. 19. Agile Wednesday, March 18, 2009
  20. 20. AGILIDADE Wednesday, March 18, 2009
  21. 21. Wednesday, March 18, 2009
  22. 22. Estamos “descobrindo” maneiras melhores de desenvolver software na prática e ajudando outros a desenvolver. Wednesday, March 18, 2009
  23. 23. Wednesday, March 18, 2009
  24. 24. Big Design Up Front “Waterfall” (Cascata) Escopo Fechado “Change Requests” Wednesday, March 18, 2009
  25. 25. Big Design Up Front “Waterfall” (Cascata) Escopo Fechado “Change Requests” Wednesday, March 18, 2009
  26. 26. Big Design Up Front “Waterfall” (Cascata) Escopo Fechado “Change Requests” Wednesday, March 18, 2009
  27. 27. Big Design Up Front “Waterfall” (Cascata) Escopo Fechado “Change Requests” Wednesday, March 18, 2009
  28. 28. Wednesday, March 18, 2009
  29. 29. Ceticismo Wednesday, March 18, 2009
  30. 30. Wednesday, March 18, 2009
  31. 31. Winston W. Royce - 1970 Wednesday, March 18, 2009
  32. 32. “Eu acredito neste conceito mas a implementação descrita acima é arriscada e convida falhas.” Winston W. Royce - 1970 Wednesday, March 18, 2009
  33. 33. “Eu acredito neste conceito mas a implementação descrita acima é arriscada e convida falhas.” Winston W. Royce - 1970 Wednesday, March 18, 2009
  34. 34. “Eu acredito neste conceito mas a implementação descrita acima é arriscada e convida falhas.” Winston W. Royce - 1970 Wednesday, March 18, 2009
  35. 35. “Cargo Cult” Wednesday, March 18, 2009
  36. 36. Wednesday, March 18, 2009
  37. 37. Wednesday, March 18, 2009
  38. 38. “SOFT”WARE Wednesday, March 18, 2009
  39. 39. Wednesday, March 18, 2009
  40. 40. Wednesday, March 18, 2009
  41. 41. 1 Wednesday, March 18, 2009
  42. 42. 2 Wednesday, March 18, 2009
  43. 43. “Matz” 1993 Wednesday, March 18, 2009
  44. 44. “Prag Dave” 2001 Wednesday, March 18, 2009
  45. 45. “DHH” 2004 Wednesday, March 18, 2009
  46. 46. Wednesday, March 18, 2009
  47. 47. Wednesday, March 18, 2009
  48. 48. “Tornar as coisas simples fáceis e as coisas complexas possíveis” Filosofia Ruby Wednesday, March 18, 2009
  49. 49. Wednesday, March 18, 2009
  50. 50. Ruby on Rails Wednesday, March 18, 2009
  51. 51. RUBY Wednesday, March 18, 2009
  52. 52. ActiveSupport Rails RUBY Wednesday, March 18, 2009
  53. 53. ActionController ActionPack ActionView ActiveSupport Rails RUBY Wednesday, March 18, 2009
  54. 54. ActiveRecord ActionController ActionPack ActionView ActiveSupport Rails RUBY Wednesday, March 18, 2009
  55. 55. ActionMailer ActiveRecord ActionController ActionPack ActionView ActiveSupport Rails RUBY Wednesday, March 18, 2009
  56. 56. ActiveResource ActionWebService ActionMailer ActiveRecord ActionController ActionPack ActionView ActiveSupport Rails RUBY Wednesday, March 18, 2009
  57. 57. Wednesday, March 18, 2009
  58. 58. Wednesday, March 18, 2009
  59. 59. Wednesday, March 18, 2009
  60. 60. Wednesday, March 18, 2009
  61. 61. Wednesday, March 18, 2009
  62. 62. Wednesday, March 18, 2009
  63. 63. Wednesday, March 18, 2009
  64. 64. Wednesday, March 18, 2009
  65. 65. Wednesday, March 18, 2009
  66. 66. RSpec describe Product do include ProductSpecHelper before(:each) do @product = Product.new end it quot;should not be valid when emptyquot; do @product.should_not be_valid end it quot;should be valid when having correct informationquot; do @product.attributes = valid_product_attributes @product.should be_valid end end Wednesday, March 18, 2009
  67. 67. RSpec describe Product do include ProductSpecHelper before(:each) do @product = Product.new end it quot;should not be valid when emptyquot; do @product.should_not be_valid spec rake end it quot;should be valid when having correct informationquot; do @product.attributes = valid_product_attributes @product.should be_valid end end Wednesday, March 18, 2009
  68. 68. Model class Product < ActiveRecord::Base after_create :set_initial_inventory has_many :variants, :dependent => :destroy has_many :images, :as => :viewable, :order => :position, :dependent => :destroy has_many :properties, :through => :product_properties belongs_to :tax_category validates_presence_of :name validates_presence_of :master_price validates_presence_of :description make_permalink :with => :name, :field => :permalink end Wednesday, March 18, 2009
  69. 69. Model class Product < ActiveRecord::Base after_create :set_initial_inventory has_many :variants, :dependent => :destroy has_many :images, :as => :viewable, :order => :position, :dependent => :destroy has_many :properties, :through => :product_properties Product.find(1) belongs_to :tax_category validates_presence_of :name validates_presence_of :master_price validates_presence_of :description make_permalink :with => :name, :field => :permalink end Wednesday, March 18, 2009
  70. 70. Controller class UsersController < Spree::BaseController resource_controller before_filter :initialize_extension_partials actions :all, :except => [:index, :destroy] show.before do @orders = Order.checkout_completed(true) .find_all_by_user_id(current_user.id) end create.after { self.current_user = @user } create.response do |wants| wants.html { redirect_back_or_default(products_path) } end end Wednesday, March 18, 2009
  71. 71. Controller class UsersController < Spree::BaseController resource_controller before_filter :initialize_extension_partials actions :all, :except => [:index, :destroy] show.before do @orders = Order.checkout_completed(true) /users/1 .find_all_by_user_id(current_user.id) end create.after { self.current_user = @user } create.response do |wants| wants.html { redirect_back_or_default(products_path) } end end Wednesday, March 18, 2009
  72. 72. Views ERB <div id=quot;product-listingquot;> <%= breadcrumbs(@taxon) %> <br/> <%= render :partial => quot;shared/products.html.erbquot;, :locals => {:products => @products, :taxon => @taxon } %> </div> <% content_for :sidebar do %> <td id=quot;shop-by-colquot; valign=quot;topquot;> <%= render :partial => quot;shared/taxonomiesquot; %> </td> <% end %> <%= render :partial => 'shared/paginate', :locals => {:collection => @products, :options => {}} unless @products.empty? %> Wednesday, March 18, 2009
  73. 73. Views HAML #product-listing =breadcrumbs(@taxon) %br =render :partial => quot;shared/products.html.erbquot;, :locals => {:products => @products, :taxon => @taxon} -content_for :sidebar do %td#shop-by-col(:valign => quot;topquot;) =render :partial => quot;shared/taxonomiesquot; =render :partial => 'shared/paginate', :locals => {:collection => @products, :options => {}} unless @products.empty? Wednesday, March 18, 2009
  74. 74. Rotas RESTFul ActionController::Routing::Routes.draw do |map| map.connect ':controller/service.wsdl', :action => 'wsdl' map.resources :products, :member => {:change_image => :post} map.resources :addresses map.resources :orders, :has_many => [:line_items] map.namespace :admin do |admin| admin.resources :users admin.resources :products end end Wednesday, March 18, 2009
  75. 75. Rotas RESTFul GET /products/new ActionController::Routing::Routes.draw do |map| map.connect ':controller/service.wsdl', :action => 'wsdl' GET /products map.resources :products, POST /products :member => {:change_image => :post} GET /products/1 map.resources :addresses map.resources :orders, :has_many => GET /products/1/edit [:line_items] PUT /products/1 map.namespace :admin do |admin| admin.resources :users DESTROY /products/1 admin.resources :products end end Wednesday, March 18, 2009
  76. 76. Migrations class RenameAppConfiguration < ActiveRecord::Migration def self.up rename_table :app_configurations, :configurations change_table :configurations do |t| t.string :type end end def self.down change_table :configurations do |t| t.remove :type end rename_table :configurations, :app_configurations end end Wednesday, March 18, 2009
  77. 77. Migrations class RenameAppConfiguration < ActiveRecord::Migration def self.up rename_table :app_configurations, :configurations change_table :configurations do |t| t.string :type rake db:migrate end end def self.down change_table :configurations do |t| t.remove :type end rename_table :configurations, :app_configurations end end Wednesday, March 18, 2009
  78. 78. “Beautiful Code” Wednesday, March 18, 2009
  79. 79. Wednesday, March 18, 2009
  80. 80. Wednesday, March 18, 2009
  81. 81. Wednesday, March 18, 2009
  82. 82. 11 mil classes! 46 só de Collections! Wednesday, March 18, 2009
  83. 83. • Classes: • Modules: • Array • Enumerable • Hash • Comparable • Set • Sorted Set Wednesday, March 18, 2009
  84. 84. 1.400 Classes: • classesArray • Modules: • • Enumerable • Hash • Comparable 6 deSet só • Collections! Set • Sorted Wednesday, March 18, 2009
  85. 85. • Convention over Configuration • Don’t Repeat Yourself • You Ain’t Gonna Need It • Boas Práticas • Escalabilidade • Segurança • Automação Wednesday, March 18, 2009
  86. 86. 2 Wednesday, March 18, 2009
  87. 87. 3 Wednesday, March 18, 2009
  88. 88. Mitos Wednesday, March 18, 2009
  89. 89. Rails não Escala Wednesday, March 18, 2009
  90. 90. Wednesday, March 18, 2009
  91. 91. To put things into perspective, though, Friendster was written in Java to start, and switched to PHP. Myspace was written in ColdFusion and transitioned to ASP.NET. When people run into problems scaling sites they often think that the language is the problem, but I think it’s rarely the case. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Wednesday, March 18, 2009
  92. 92. “The New York Times used Ruby on Rails to pull together, analyze and display election results in near real time on one of its busiest Web traffic days ever. ” http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1 Wednesday, March 18, 2009
  93. 93. “They serve up 23 million visitors a month. The conversion resulted in 20,000 lines of Ruby code instead of 125,000 lines of Java code, and most importantly eased the difficulty they had in maintaining it. Once complete, and optimized their site is now faster than before. They also completed the rewrite in three months with four developers.” http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails Wednesday, March 18, 2009
  94. 94. Wednesday, March 18, 2009
  95. 95. Wednesday, March 18, 2009
  96. 96. Mitos Wednesday, March 18, 2009
  97. 97. Deployment de Rails é difícil Wednesday, March 18, 2009
  98. 98. Wednesday, March 18, 2009
  99. 99. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  100. 100. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  101. 101. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  102. 102. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  103. 103. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  104. 104. Apache + FastCGI LightTPD + FastCGI Litespeed + SAPI Apache + Mongrel Nginx + Mongrel Nginx + Thin Wednesday, March 18, 2009
  105. 105. Wednesday, March 18, 2009
  106. 106. gem install passenger passenger-install-apache2-module Wednesday, March 18, 2009
  107. 107. Wednesday, March 18, 2009
  108. 108. Wednesday, March 18, 2009
  109. 109. Mitos Wednesday, March 18, 2009
  110. 110. Rails é mal documentado Wednesday, March 18, 2009
  111. 111. Geoffrey Wednesday, March 18, 2009
  112. 112. Jason e Gregg Wednesday, March 18, 2009
  113. 113. Pratik Naik Wednesday, March 18, 2009
  114. 114. Satish Talim Wednesday, March 18, 2009
  115. 115. Peter Cooper Wednesday, March 18, 2009
  116. 116. _why Wednesday, March 18, 2009
  117. 117. Ryan Bates Wednesday, March 18, 2009
  118. 118. Wednesday, March 18, 2009
  119. 119. Wednesday, March 18, 2009
  120. 120. 3 Wednesday, March 18, 2009
  121. 121. 4 Wednesday, March 18, 2009
  122. 122. Open Source Wednesday, March 18, 2009
  123. 123. Chris Wanstrath Wednesday, March 18, 2009
  124. 124. Wednesday, March 18, 2009
  125. 125. Wednesday, March 18, 2009
  126. 126. Wednesday, March 18, 2009
  127. 127. Wednesday, March 18, 2009
  128. 128. Conferências Wednesday, March 18, 2009
  129. 129. Wednesday, March 18, 2009
  130. 130. Wednesday, March 18, 2009
  131. 131. Wednesday, March 18, 2009
  132. 132. Wednesday, March 18, 2009
  133. 133. Wednesday, March 18, 2009
  134. 134. Wednesday, March 18, 2009
  135. 135. 4 Wednesday, March 18, 2009
  136. 136. One more thing ... Wednesday, March 18, 2009
  137. 137. Wednesday, March 18, 2009
  138. 138. “Especialista de uma coisa só é um amador em todo o resto.” Wednesday, March 18, 2009
  139. 139. Obrigado! www.akitaonrails.com Wednesday, March 18, 2009
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×