SlideShare a Scribd company logo
1 of 188
Download to read offline
Ruby on Rails
Tuesday, September 8, 2009
AkitaOnRails.com
           slideshare.net/akitaonrails




Tuesday, September 8, 2009
2008
Tuesday, September 8, 2009
2008
Tuesday, September 8, 2009
13 e 14
                             Outubro

                             2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
> 100 slides
                               < 1 hora


Tuesday, September 8, 2009
www.slideshare.net/akitaonrails

                   fabio.akita@locaweb.com.br




Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Ruby on Rails              2.3

                             Ruby   1.8

           “Novo” Ruby              1.9
Tuesday, September 8, 2009
Ruby on Rails              2.3

                             Ruby   1.8

           “Novo” Ruby              1.9
Tuesday, September 8, 2009
Ruby on Rails              2.3

                             Ruby   1.8

           “Novo” Ruby              1.9
Tuesday, September 8, 2009
“Matz”




                             1993
Tuesday, September 8, 2009
Tuesday, September 8, 2009
“Prag Dave”




                             2001
Tuesday, September 8, 2009
Tuesday, September 8, 2009
“DHH”



                              2004
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Charles Nutter



                                  2006
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
“Tornar as coisas
              simples fáceis e as
               coisas complexas
                   possíveis”
                             Filosofia Ruby

Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Orientação a
                               Objetos


Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
“Eu inventei o
                             termo ‘orientação
                             a objetos’, e posso
                               lhes dizer que eu
                                  não estava
                             pensando em C++.”


Tuesday, September 8, 2009
Meta-programação



Tuesday, September 8, 2009
Meta-apresentação



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Ruby on Rails



Tuesday, September 8, 2009
Código que gera Código

Convention over Configuration

                  Don’t Repeat Yourself

                Extreme Programming
Tuesday, September 8, 2009
Código que gera Código

Convention over Configuration

                  Don’t Repeat Yourself

                Extreme Programming
Tuesday, September 8, 2009
Código que gera Código

Convention over Configuration

                  Don’t Repeat Yourself

                Extreme Programming
Tuesday, September 8, 2009
Código que gera Código

Convention over Configuration

                  Don’t Repeat Yourself

                Extreme Programming
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
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




Tuesday, September 8, 2009
Views ERB
  <div id="product-listing">
    <%= breadcrumbs(@taxon) %>
    <br/>
    <%= render :partial => "shared/products.html.erb",
    :locals => {:products => @products, :taxon => @taxon } %>
  </div>

  <% content_for :sidebar do %>
    <td id="shop-by-col" valign="top">
      <%= render :partial => "shared/taxonomies" %>
    </td>
  <% end %>

  <%= render :partial => 'shared/paginate',
    :locals => {:collection => @products, :options => {}}
    unless @products.empty? %>



Tuesday, September 8, 2009
Views ERB
  <div id="product-listing">
    <%= breadcrumbs(@taxon) %>
    <br/>
    <%= render :partial => "shared/products.html.erb",
    :locals => {:products => @products, :taxon => @taxon } %>
  </div>

  <% content_for :sidebar do %>
    <td id="shop-by-col" valign="top">
      <%= render :partial => "shared/taxonomies" %>
    </td>
  <% end %>

  <%= render :partial => 'shared/paginate',
    :locals => {:collection => @products, :options => {}}
    unless @products.empty? %>



Tuesday, September 8, 2009
Views ERB
  <div id="product-listing">
    <%= breadcrumbs(@taxon) %>
    <br/>
    <%= render :partial => "shared/products.html.erb",
    :locals => {:products => @products, :taxon => @taxon } %>
  </div>

  <% content_for :sidebar do %>
    <td id="shop-by-col" valign="top">
      <%= render :partial => "shared/taxonomies" %>
    </td>
  <% end %>

  <%= render :partial => 'shared/paginate',
    :locals => {:collection => @products, :options => {}}
    unless @products.empty? %>



Tuesday, September 8, 2009
Rotas RESTFul



  ActionController::Routing::Routes.draw do |map|

      map.resources :products
      map.resources :addresses
      map.resources :orders,     :has_many => [:line_items]

    map.namespace :admin do |admin|
      admin.resources :users
      admin.resources :products
    end
  end




Tuesday, September 8, 2009
Rotas RESTFul



  ActionController::Routing::Routes.draw do |map|

      map.resources :products
      map.resources :addresses
      map.resources :orders,     :has_many => [:line_items]

    map.namespace :admin do |admin|
      admin.resources :users
      admin.resources :products
    end
  end




Tuesday, September 8, 2009
Rotas RESTFul



  ActionController::Routing::Routes.draw do |map|

      map.resources :products
      map.resources :addresses
      map.resources :orders,     :has_many => [:line_items]

    map.namespace :admin do |admin|
      admin.resources :users
      admin.resources :products
    end
  end




Tuesday, September 8, 2009
Rotas RESTFul



  ActionController::Routing::Routes.draw do |map|

      map.resources :products
      map.resources :addresses
      map.resources :orders,     :has_many => [:line_items]

    map.namespace :admin do |admin|
      admin.resources :users
      admin.resources :products
    end
  end




Tuesday, September 8, 2009
Rotas RESTFul



                 GET /products/new
  ActionController::Routing::Routes.draw do |map|
                 GET /products
                 POST /products
    map.resources :products
    map.resources :addresses
    map.resourcesGET /products/1 => [:line_items]
                  :orders,    :has_many

    map.namespaceGET /products/1/edit
                  :admin do |admin|
                 PUT /products/1
      admin.resources :users
      admin.resources :products
    end          DESTROY /products/1
  end




Tuesday, September 8, 2009
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


Tuesday, September 8, 2009
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


Tuesday, September 8, 2009
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


Tuesday, September 8, 2009
“Beautiful Code”



Tuesday, September 8, 2009
@Transient
                                                                 public BigDecimal getTotal()
      //$Id: Booking.java 5579 2007-06-27 00:06:49Z gavin $      {
      package org.jboss.seam.example.booking;                       return hotel.getPrice().multiply( new BigDecimal( getNights() ) );
                                                                 }
      import   java.io.Serializable;
      import   java.math.BigDecimal;                             @Transient
      import   java.text.DateFormat;                             public int getNights()
      import   java.util.Date;                                   {
                                                                    return (int) ( checkoutDate.getTime() - checkinDate.getTime() ) /
      import   javax.persistence.Basic;                       1000 / 60 / 60 / 24;
      import   javax.persistence.Entity;                         }
      import   javax.persistence.GeneratedValue;
      import   javax.persistence.Id;                             @Id @GeneratedValue
      import   javax.persistence.ManyToOne;                      public Long getId()
      import   javax.persistence.Temporal;                       {
      import   javax.persistence.TemporalType;                      return id;
      import   javax.persistence.Transient;                      }
                                                                 public void setId(Long id)
      import   org.hibernate.validator.Length;                   {
      import   org.hibernate.validator.NotNull;                     this.id = id;
      import   org.hibernate.validator.Pattern;                  }
      import   org.jboss.seam.annotations.Name;
                                                                 @NotNull
      @Entity                                                    @Basic @Temporal(TemporalType.DATE)
      @Name("booking")                                           public Date getCheckinDate()
      public class Booking implements Serializable               {
      {                                                             return checkinDate;
         private Long id;                                        }
         private User user;                                      public void setCheckinDate(Date datetime)
         private Hotel hotel;                                    {
         private Date checkinDate;                                  this.checkinDate = datetime;
         private Date checkoutDate;                              }
         private String creditCard;
         private String creditCardName;                          @ManyToOne @NotNull
         private int creditCardExpiryMonth;                      public Hotel getHotel()
         private int creditCardExpiryYear;                       {
         private boolean smoking;                                   return hotel;
         private int beds;                                       }
                                                                 public void setHotel(Hotel hotel)
         public Booking() {}                                     {
                                                                    this.hotel = hotel;
         public Booking(Hotel hotel, User user)                  }
         {
            this.hotel = hotel;                                  @ManyToOne @NotNull
            this.user = user;                                    public User getUser()
         }                                                       {
                                                                    return user;
                                                                 }

Tuesday, September 8, 2009
public int getBeds()
  public void setUser(User user)
                                                                                  {
  {
                                                                                     return beds;
     this.user = user;
                                                                                  }
  }

                                                                                  public void setBeds(int beds)
  @Basic @Temporal(TemporalType.DATE)
                                                                                  {
  @NotNull
                                                                                     this.beds = beds;
  public Date getCheckoutDate()
                                                                                  }
  {
                                                                                  @NotNull(message="Credit card name is required")
     return checkoutDate;
                                                                                  @Length(min=3, max=70, message="Credit card name is required")
  }
                                                                                  public String getCreditCardName()
  public void setCheckoutDate(Date checkoutDate)
                                                                                  {
  {
                                                                                     return creditCardName;
     this.checkoutDate = checkoutDate;
                                                                                  }
  }

                                                                                  public void setCreditCardName(String creditCardName)
  @NotNull(message="Credit card number is required")
                                                                                  {
  @Length(min=16, max=16, message="Credit card number must 16 digits long")
                                                                                     this.creditCardName = creditCardName;
  @Pattern(regex="^d*$", message="Credit card number must be numeric")
                                                                                  }
  public String getCreditCard()
  {
                                                                                  public int getCreditCardExpiryMonth()
     return creditCard;
                                                                                  {
  }
                                                                                     return creditCardExpiryMonth;
                                                                                  }
  public void setCreditCard(String creditCard)
  {
                                                                                  public void setCreditCardExpiryMonth(int creditCardExpiryMonth)
     this.creditCard = creditCard;
                                                                                  {
  }
                                                                                     this.creditCardExpiryMonth = creditCardExpiryMonth;
                                                                                  }
  @Transient
  public String getDescription()
                                                                                  public int getCreditCardExpiryYear()
  {
                                                                                  {
     DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM);
                                                                                     return creditCardExpiryYear;
     return hotel==null ? null : hotel.getName() +
                                                                                  }
           ", " + df.format( getCheckinDate() ) +
           " to " + df.format( getCheckoutDate() );
                                                                                  public void setCreditCardExpiryYear(int creditCardExpiryYear)
  }
                                                                                  {
                                                                                     this.creditCardExpiryYear = creditCardExpiryYear;
  public boolean isSmoking()
                                                                                  }
  {
     return smoking;
                                                                                  @Override
  }
                                                                                  public String toString()
                                                                                  {
  public void setSmoking(boolean smoking)
                                                                                     return "Booking(" + user + ","+ hotel + ")";
  {
                                                                                  }
     this.smoking = smoking;
  }
                                                                              }


Tuesday, September 8, 2009
class Booking < ActiveRecord::Base
               belongs_to :hotel
               belongs_to :user
               validates_presence_of :hotel
               validates_presence_of :user
               validates_presence_of :credit_card
               validates_presence_of :credit_card_name
               validates_length_of :credit_card, :within => 16..16
               validates_format_of :credit_card, :with => /^d*$/
               validates_length_of :credit_card_name, :within => 3..70

                 def total
                   hotel.price * nights
                 end

                 def nights
                   ((checkout_date - checkin_date) / 1.day).round
                 end

               def to_s
                 "Booking(#{user},#{hotel})"
               end
             end
Tuesday, September 8, 2009
class Booking < ActiveRecord::Base
               belongs_to :hotel
               belongs_to :user
               validates_presence_of :hotel
               validates_presence_of :user
               validates_presence_of :credit_card
               validates_presence_of :credit_card_name
               validates_length_of :credit_card, :within => 16..16
               validates_format_of :credit_card, :with => /^d*$/
               validates_length_of :credit_card_name, :within => 3..70

                 def total
                   hotel.price * nights
                 end

                 def nights
                   ((checkout_date - checkin_date) / 1.day).round
                 end

               def to_s
                 "Booking(#{user},#{hotel})"
               end
             end
Tuesday, September 8, 2009
class CreateBookings < ActiveRecord::Migration
                         def self.up
                           create_table :bookings do |t|
                             t.references :user
                             t.references :hotel
                             t.datetime :checkin
                             t.datetime :checkout
                             t.string :credit_card
                             t.string :credit_card_name
                             t.integer :credit_card_expiry_month
                             t.integer :credit_card_expiry_year
                             t.boolean :smoking
                             t.integer :beds

                                 t.timestamps
                               end
                             end

                         def self.down
                           drop_table :bookings
                         end
                       end

Tuesday, September 8, 2009
class CreateBookings < ActiveRecord::Migration
                         def self.up
                           create_table :bookings do |t|
                             t.references :user
                             t.references :hotel
                             t.datetime :checkin
                             t.datetime :checkout
                             t.string :credit_card
                             t.string :credit_card_name
                             t.integer :credit_card_expiry_month
                             t.integer :credit_card_expiry_year
                             t.boolean :smoking
                             t.integer :beds

                                 t.timestamps
                               end
                             end

                         def self.down
                           drop_table :bookings
                         end
                       end

Tuesday, September 8, 2009
class CreateBookings < ActiveRecord::Migration
                         def self.up
                           create_table :bookings do |t|
                             t.references :user
                             t.references :hotel
                             t.datetime :checkin
                             t.datetime :checkout
                             t.string :credit_card
                             t.string :credit_card_name
                             t.integer :credit_card_expiry_month
                             t.integer :credit_card_expiry_year
                             t.boolean :smoking
                             t.integer :beds

                                 t.timestamps
                               end
                             end

                         def self.down
                           drop_table :bookings
                         end
                       end

Tuesday, September 8, 2009
190
                             vs
                             40

Tuesday, September 8, 2009
“Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em
              20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante,
                 facilitou a dificuldade que tinham em manutenção. Eles também
            finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores.
            Uma vez completo e otimizado, o site deles agora é mais rápido que antes.”




                             http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails




Tuesday, September 8, 2009
“Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em
              20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante,
                 facilitou a dificuldade que tinham em manutenção. Eles também
            finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores.
            Uma vez completo e otimizado, o site deles agora é mais rápido que antes.”




                             http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails




Tuesday, September 8, 2009
“Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em
              20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante,
                 facilitou a dificuldade que tinham em manutenção. Eles também
            finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores.
            Uma vez completo e otimizado, o site deles agora é mais rápido que antes.”




                             http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails




Tuesday, September 8, 2009
“Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em
              20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante,
                 facilitou a dificuldade que tinham em manutenção. Eles também
            finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores.
            Uma vez completo e otimizado, o site deles agora é mais rápido que antes.”




                             http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails




Tuesday, September 8, 2009
Ferramentas
                                Ágeis


Tuesday, September 8, 2009
Gitorious
       Repositórios
                                    Github

       Integração                 Integrity
       Contínua              Cruise Control

                                Capistrano
       Deployment
                                   Puppet


       Monitoramento             New Relic

Tuesday, September 8, 2009
Gitorious
       Repositórios
                                    Github

       Integração                 Integrity
       Contínua              Cruise Control

                                Capistrano
       Deployment
                                   Puppet


       Monitoramento             New Relic

Tuesday, September 8, 2009
Gitorious
       Repositórios
                                    Github

       Integração                 Integrity
       Contínua              Cruise Control

                                Capistrano
       Deployment
                                   Puppet


       Monitoramento             New Relic

Tuesday, September 8, 2009
Gitorious
       Repositórios
                                    Github

       Integração                 Integrity
       Contínua              Cruise Control

                                Capistrano
       Deployment
                                   Puppet


       Monitoramento             New Relic

Tuesday, September 8, 2009
Comunidade



Tuesday, September 8, 2009
peepcode.com




                                            Geoffrey
Tuesday, September 8, 2009
railsenvy.com




                                             Jason e Gregg
Tuesday, September 8, 2009
railscasts.com




                                              Ryan Bates
Tuesday, September 8, 2009
rubylearning.org




                                                Satish Talim
Tuesday, September 8, 2009
rubyinside.com.br




                                            Peter Cooper
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
O que dizem
                               por aí ...


Tuesday, September 8, 2009
Pouco usado



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Rails não Escala



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Blaine Cook

                             http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter


Tuesday, September 8, 2009
Para colocar as coisas em
      perspectiva, o Friendster foi
          escrito em Java e eles
      mudaram para PHP. MySpace
      foi escrito em ColdFusion e
      eles mudaram para ASP.NET.




                                                                                  Blaine Cook

                             http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter


Tuesday, September 8, 2009
Para colocar as coisas em
      perspectiva, o Friendster foi
          escrito em Java e eles
      mudaram para PHP. MySpace
      foi escrito em ColdFusion e
      eles mudaram para ASP.NET.

     Quando as pessoas caem em
      problemas de escalabilidade,
       normalmente acham que a
     linguagem é o problema, mas
      eu acho que isso raramente
             é a realidade.                                                       Blaine Cook

                             http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter


Tuesday, September 8, 2009
“O The New York Times usou Ruby on Rails para
              agregar, analizar e mostrar os resultados das
            eleições em quase tempo real em um de seus
             sites mais acessados de todos os tempos.”



                      http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1




Tuesday, September 8, 2009
“O The New York Times usou Ruby on Rails para
              agregar, analizar e mostrar os resultados das
            eleições em quase tempo real em um de seus
             sites mais acessados de todos os tempos.”



                      http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1




Tuesday, September 8, 2009
Ruby é Lento



Tuesday, September 8, 2009
x mais lento que C++




Tuesday, September 8, 2009
x mais lento que C++
                             0
                                 50
                                               100
     Python 2                                                150

      Ruby 1.9                                                     200

            Perl

           JRuby

         Python 3

               PHP

         Ruby 1.8.6




Tuesday, September 8, 2009
Homepage: 331 ms




Tuesday, September 8, 2009
Homepage: 331 ms

                             Total: 5.45 s
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Performance
                                 !=
                      Escalabilidade

Tuesday, September 8, 2009
Outros Mitos?



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Mais Produtivo

                              “Melhor”

                             Anti-legado
Tuesday, September 8, 2009
Mais Produtivo

                              “Melhor”

                             Anti-legado
Tuesday, September 8, 2009
Mais Produtivo

                              “Melhor”

                             Anti-legado
Tuesday, September 8, 2009
Agilidade



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Robert C. Martin


Tuesday, September 8, 2009
“Uncle Bob”

Tuesday, September 8, 2009
Código Limpo



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Test Driven
                             Development


Tuesday, September 8, 2009
Tuesday, September 8, 2009
describe BankAccount do
           before :each do
             @bank_account = BankAccount.new :balance => 250
           end

             it "should not be valid" do
               @bank_account.should be_valid
             end

           it "should transfer funds successfully" do
             @bank_account.should_receive(:transfer)
               .with_args(:amount => 100)
               .and_return(true)
             @bank_account.execute_transaction(:amount => 100)
             @bank_account.balance.should == 150
           end
         end


Tuesday, September 8, 2009
describe BankAccount do
           before :each do
             @bank_account = BankAccount.new :balance => 250
           end

             it "should not be valid" do
               @bank_account.should be_valid
             end

           it "should transfer funds successfully" do
             @bank_account.should_receive(:transfer)
               .with_args(:amount => 100)
               .and_return(true)
             @bank_account.execute_transaction(:amount => 100)
             @bank_account.balance.should == 150
           end
         end


Tuesday, September 8, 2009
describe BankAccount do
           before :each do
             @bank_account = BankAccount.new :balance => 250
           end

             it "should not be valid" do
               @bank_account.should be_valid
             end

           it "should transfer funds successfully" do
             @bank_account.should_receive(:transfer)
               .with_args(:amount => 100)
               .and_return(true)
             @bank_account.execute_transaction(:amount => 100)
             @bank_account.balance.should == 150
           end
         end


Tuesday, September 8, 2009
describe BankAccount do
           before :each do
             @bank_account = BankAccount.new :balance => 250
           end

             it "should not be valid" do
               @bank_account.should be_valid
             end

           it "should transfer funds successfully" do
             @bank_account.should_receive(:transfer)
               .with_args(:amount => 100)
               .and_return(true)
             @bank_account.execute_transaction(:amount => 100)
             @bank_account.balance.should == 150
           end
         end


Tuesday, September 8, 2009
Tuesday, September 8, 2009
Funcionalidade: Adição
               Para evitar erros bobos
               Como um péssimo matemático
               Eu quero saber como somar dois números

                 Cenário: Adicionar dois números
                   Dado que eu digitei 50 na calculadora
                   E que eu digitei 70 na calculadora
                   Quando eu aperto o botão de soma
                   Então o resultado na calculadora deve ser 120




Tuesday, September 8, 2009
Funcionalidade: Adição
               Para evitar erros bobos
               Como um péssimo matemático
               Eu quero saber como somar dois números

                 Cenário: Adicionar dois números
                   Dado que eu digitei 50 na calculadora
                   E que eu digitei 70 na calculadora
                   Quando eu aperto o botão de soma
                   Então o resultado na calculadora deve ser 120




Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
Não é mais
                             demorado?


Tuesday, September 8, 2009
Cowboy   Profissional




Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Cowboy                       Profissional

                70.00



                52.50
Produtividade




                35.00



                17.50



                   0
                        1   2   3    4       5   6           7    8      9     10   11   12
                                                     Tempo
 Tuesday, September 8, 2009
Tuesday, September 8, 2009
Tuesday, September 8, 2009
237 Equipes
                    137 Finalizadas


Tuesday, September 8, 2009
Tuesday, September 8, 2009
Empreendedorismo

                             Código e “Forma”

          Ciclo de Vida de Projetos

        Comunidade Open Source
Tuesday, September 8, 2009
Empreendedorismo

                             Código e “Forma”

          Ciclo de Vida de Projetos

        Comunidade Open Source
Tuesday, September 8, 2009
Empreendedorismo

                             Código e “Forma”

          Ciclo de Vida de Projetos

        Comunidade Open Source
Tuesday, September 8, 2009
Empreendedorismo

                             Código e “Forma”

          Ciclo de Vida de Projetos

        Comunidade Open Source
Tuesday, September 8, 2009
Profissionalismo



Tuesday, September 8, 2009
Tuesday, September 8, 2009
Obrigado!
                              akitaonrails.com


                             railssummit.com.br




Tuesday, September 8, 2009

More Related Content

Similar to Enecomp 2009

2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 20092009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009Caue Guerra
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 KeynoteTed Leung
 
Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fabio Akita
 
And the Greatest of These Is ... Space
And the Greatest of These Is ... SpaceAnd the Greatest of These Is ... Space
And the Greatest of These Is ... SpaceBen Scofield
 
Rails For Kids 2009
Rails For Kids 2009Rails For Kids 2009
Rails For Kids 2009Fabio Akita
 
Ecossistema Rails Campus Party 09
Ecossistema Rails   Campus Party 09Ecossistema Rails   Campus Party 09
Ecossistema Rails Campus Party 09Fabio Akita
 
Rhouse - Home automation is ruby ?
Rhouse - Home automation is ruby ?Rhouse - Home automation is ruby ?
Rhouse - Home automation is ruby ?Fernand Galiana
 
Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Phil Sturgeon
 
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & less
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & lessLiebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & less
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & lessjan_mindmatters
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMatt Aimonetti
 
Backbone intro
Backbone introBackbone intro
Backbone introIan Yang
 
Cooking an Omelette with Chef
Cooking an Omelette with ChefCooking an Omelette with Chef
Cooking an Omelette with Chefctaintor
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeRebecca Murphey
 
Feature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and ProfitFeature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and ProfitDaniel Schauenberg
 
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013swentel
 
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010Plataformatec
 
O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3Hugo Baraúna
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJSRan Mizrahi
 
Provisioning profiles like a Pro
Provisioning profiles like a ProProvisioning profiles like a Pro
Provisioning profiles like a ProJay Graves
 
Angrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAngrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAOE
 

Similar to Enecomp 2009 (20)

2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 20092009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
2009, o ano do Ruby on Rails no Brasil - CaelumDay 2009
 
DjangoCon 2009 Keynote
DjangoCon 2009 KeynoteDjangoCon 2009 Keynote
DjangoCon 2009 Keynote
 
Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009Fórum de Software Livre do Serpro RJ 2009
Fórum de Software Livre do Serpro RJ 2009
 
And the Greatest of These Is ... Space
And the Greatest of These Is ... SpaceAnd the Greatest of These Is ... Space
And the Greatest of These Is ... Space
 
Rails For Kids 2009
Rails For Kids 2009Rails For Kids 2009
Rails For Kids 2009
 
Ecossistema Rails Campus Party 09
Ecossistema Rails   Campus Party 09Ecossistema Rails   Campus Party 09
Ecossistema Rails Campus Party 09
 
Rhouse - Home automation is ruby ?
Rhouse - Home automation is ruby ?Rhouse - Home automation is ruby ?
Rhouse - Home automation is ruby ?
 
Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013Become Master of Your Own Universe - DIBI 2013
Become Master of Your Own Universe - DIBI 2013
 
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & less
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & lessLiebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & less
Liebe Dein Frontend wie Dich selbst! HAML & SASS & COMPASS & less
 
MacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meetMacRuby - When objective-c and Ruby meet
MacRuby - When objective-c and Ruby meet
 
Backbone intro
Backbone introBackbone intro
Backbone intro
 
Cooking an Omelette with Chef
Cooking an Omelette with ChefCooking an Omelette with Chef
Cooking an Omelette with Chef
 
Using Objects to Organize your jQuery Code
Using Objects to Organize your jQuery CodeUsing Objects to Organize your jQuery Code
Using Objects to Organize your jQuery Code
 
Feature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and ProfitFeature Flagging your Infrastructure for Fun and Profit
Feature Flagging your Infrastructure for Fun and Profit
 
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013Drupal 8 configuration system for coders and site builders - Drupalaton 2013
Drupal 8 configuration system for coders and site builders - Drupalaton 2013
 
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
O que há de novo no Rails 3 - Ruby on Rails no Mundo Real - 23may2010
 
O que há de novo no Rails 3
O que há de novo no Rails 3O que há de novo no Rails 3
O que há de novo no Rails 3
 
Dependency Injection @ AngularJS
Dependency Injection @ AngularJSDependency Injection @ AngularJS
Dependency Injection @ AngularJS
 
Provisioning profiles like a Pro
Provisioning profiles like a ProProvisioning profiles like a Pro
Provisioning profiles like a Pro
 
Angrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance ShopAngrybirds - Overview for a High Performance Shop
Angrybirds - Overview for a High Performance Shop
 

More from Fabio Akita

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São CarlosFabio Akita
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about LanguagesFabio Akita
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Fabio Akita
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPFabio Akita
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaFabio Akita
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersFabio Akita
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG CampinasFabio Akita
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Fabio Akita
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to RubyFabio Akita
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIFabio Akita
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening KeynoteFabio Akita
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017Fabio Akita
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APFabio Akita
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017Fabio Akita
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017Fabio Akita
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayFabio Akita
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016Fabio Akita
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Fabio Akita
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraFabio Akita
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilFabio Akita
 

More from Fabio Akita (20)

Devconf 2019 - São Carlos
Devconf 2019 - São CarlosDevconf 2019 - São Carlos
Devconf 2019 - São Carlos
 
Meetup Nerdzão - English Talk about Languages
Meetup Nerdzão  - English Talk about LanguagesMeetup Nerdzão  - English Talk about Languages
Meetup Nerdzão - English Talk about Languages
 
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
Desmistificando Blockchains p/ Developers - Criciuma Dev Conf 2018
 
Desmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SPDesmistificando Blockchains - 20o Encontro Locaweb SP
Desmistificando Blockchains - 20o Encontro Locaweb SP
 
Desmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter GoianiaDesmistificando Blockchains - Insiter Goiania
Desmistificando Blockchains - Insiter Goiania
 
Blockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7MastersBlockchain em 7 minutos - 7Masters
Blockchain em 7 minutos - 7Masters
 
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
Elixir  -Tolerância a Falhas para Adultos - GDG CampinasElixir  -Tolerância a Falhas para Adultos - GDG Campinas
Elixir -Tolerância a Falhas para Adultos - GDG Campinas
 
Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017Desmistificando Mitos de Tech Startups - Intercon 2017
Desmistificando Mitos de Tech Startups - Intercon 2017
 
30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby30 Days to Elixir and Crystal and Back to Ruby
30 Days to Elixir and Crystal and Back to Ruby
 
Uma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TIUma Discussão sobre a Carreira de TI
Uma Discussão sobre a Carreira de TI
 
THE CONF - Opening Keynote
THE CONF - Opening KeynoteTHE CONF - Opening Keynote
THE CONF - Opening Keynote
 
A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017A Journey through New Languages - Rancho Dev 2017
A Journey through New Languages - Rancho Dev 2017
 
Desmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - APDesmistificando Mitos de Startups - Sebrae - AP
Desmistificando Mitos de Startups - Sebrae - AP
 
A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017A Journey through New Languages - Guru Sorocaba 2017
A Journey through New Languages - Guru Sorocaba 2017
 
A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017A Journey through New Languages - Insiter 2017
A Journey through New Languages - Insiter 2017
 
A Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech DayA Journey through New Languages - Locaweb Tech Day
A Journey through New Languages - Locaweb Tech Day
 
A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016A Journey through new Languages - Intercon 2016
A Journey through new Languages - Intercon 2016
 
Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016Premature Optimization 2.0 - Intercon 2016
Premature Optimization 2.0 - Intercon 2016
 
Conexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização PrematuraConexão Kinghost - Otimização Prematura
Conexão Kinghost - Otimização Prematura
 
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All EvilThe Open Commerce Conference - Premature Optimisation: The Root of All Evil
The Open Commerce Conference - Premature Optimisation: The Root of All Evil
 

Recently uploaded

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Mark Simos
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 
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
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfngoud9212
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 

Recently uploaded (20)

Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
Tampa BSides - Chef's Tour of Microsoft Security Adoption Framework (SAF)
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 
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...
 
Bluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdfBluetooth Controlled Car with Arduino.pdf
Bluetooth Controlled Car with Arduino.pdf
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 

Enecomp 2009

  • 1. Ruby on Rails Tuesday, September 8, 2009
  • 2. AkitaOnRails.com slideshare.net/akitaonrails Tuesday, September 8, 2009
  • 5. 13 e 14 Outubro 2009 Tuesday, September 8, 2009
  • 7. > 100 slides < 1 hora Tuesday, September 8, 2009
  • 8. www.slideshare.net/akitaonrails fabio.akita@locaweb.com.br Tuesday, September 8, 2009
  • 12. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Tuesday, September 8, 2009
  • 13. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Tuesday, September 8, 2009
  • 14. Ruby on Rails 2.3 Ruby 1.8 “Novo” Ruby 1.9 Tuesday, September 8, 2009
  • 15. “Matz” 1993 Tuesday, September 8, 2009
  • 17. “Prag Dave” 2001 Tuesday, September 8, 2009
  • 19. “DHH” 2004 Tuesday, September 8, 2009
  • 22. Charles Nutter 2006 Tuesday, September 8, 2009
  • 27. “Tornar as coisas simples fáceis e as coisas complexas possíveis” Filosofia Ruby Tuesday, September 8, 2009
  • 32. Orientação a Objetos Tuesday, September 8, 2009
  • 36. “Eu inventei o termo ‘orientação a objetos’, e posso lhes dizer que eu não estava pensando em C++.” Tuesday, September 8, 2009
  • 40. Ruby on Rails Tuesday, September 8, 2009
  • 41. Código que gera Código Convention over Configuration Don’t Repeat Yourself Extreme Programming Tuesday, September 8, 2009
  • 42. Código que gera Código Convention over Configuration Don’t Repeat Yourself Extreme Programming Tuesday, September 8, 2009
  • 43. Código que gera Código Convention over Configuration Don’t Repeat Yourself Extreme Programming Tuesday, September 8, 2009
  • 44. Código que gera Código Convention over Configuration Don’t Repeat Yourself Extreme Programming Tuesday, September 8, 2009
  • 59. 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 Tuesday, September 8, 2009
  • 60. 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 Tuesday, September 8, 2009
  • 61. 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 Tuesday, September 8, 2009
  • 62. 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 Tuesday, September 8, 2009
  • 63. 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 Tuesday, September 8, 2009
  • 64. 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 Tuesday, September 8, 2009
  • 65. 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 Tuesday, September 8, 2009
  • 66. Views ERB <div id="product-listing"> <%= breadcrumbs(@taxon) %> <br/> <%= render :partial => "shared/products.html.erb", :locals => {:products => @products, :taxon => @taxon } %> </div> <% content_for :sidebar do %> <td id="shop-by-col" valign="top"> <%= render :partial => "shared/taxonomies" %> </td> <% end %> <%= render :partial => 'shared/paginate', :locals => {:collection => @products, :options => {}} unless @products.empty? %> Tuesday, September 8, 2009
  • 67. Views ERB <div id="product-listing"> <%= breadcrumbs(@taxon) %> <br/> <%= render :partial => "shared/products.html.erb", :locals => {:products => @products, :taxon => @taxon } %> </div> <% content_for :sidebar do %> <td id="shop-by-col" valign="top"> <%= render :partial => "shared/taxonomies" %> </td> <% end %> <%= render :partial => 'shared/paginate', :locals => {:collection => @products, :options => {}} unless @products.empty? %> Tuesday, September 8, 2009
  • 68. Views ERB <div id="product-listing"> <%= breadcrumbs(@taxon) %> <br/> <%= render :partial => "shared/products.html.erb", :locals => {:products => @products, :taxon => @taxon } %> </div> <% content_for :sidebar do %> <td id="shop-by-col" valign="top"> <%= render :partial => "shared/taxonomies" %> </td> <% end %> <%= render :partial => 'shared/paginate', :locals => {:collection => @products, :options => {}} unless @products.empty? %> Tuesday, September 8, 2009
  • 69. Rotas RESTFul ActionController::Routing::Routes.draw do |map| map.resources :products map.resources :addresses map.resources :orders, :has_many => [:line_items] map.namespace :admin do |admin| admin.resources :users admin.resources :products end end Tuesday, September 8, 2009
  • 70. Rotas RESTFul ActionController::Routing::Routes.draw do |map| map.resources :products map.resources :addresses map.resources :orders, :has_many => [:line_items] map.namespace :admin do |admin| admin.resources :users admin.resources :products end end Tuesday, September 8, 2009
  • 71. Rotas RESTFul ActionController::Routing::Routes.draw do |map| map.resources :products map.resources :addresses map.resources :orders, :has_many => [:line_items] map.namespace :admin do |admin| admin.resources :users admin.resources :products end end Tuesday, September 8, 2009
  • 72. Rotas RESTFul ActionController::Routing::Routes.draw do |map| map.resources :products map.resources :addresses map.resources :orders, :has_many => [:line_items] map.namespace :admin do |admin| admin.resources :users admin.resources :products end end Tuesday, September 8, 2009
  • 73. Rotas RESTFul GET /products/new ActionController::Routing::Routes.draw do |map| GET /products POST /products map.resources :products map.resources :addresses map.resourcesGET /products/1 => [:line_items] :orders, :has_many map.namespaceGET /products/1/edit :admin do |admin| PUT /products/1 admin.resources :users admin.resources :products end DESTROY /products/1 end Tuesday, September 8, 2009
  • 74. 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 Tuesday, September 8, 2009
  • 75. 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 Tuesday, September 8, 2009
  • 76. 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 Tuesday, September 8, 2009
  • 78. @Transient public BigDecimal getTotal() //$Id: Booking.java 5579 2007-06-27 00:06:49Z gavin $ { package org.jboss.seam.example.booking; return hotel.getPrice().multiply( new BigDecimal( getNights() ) ); } import java.io.Serializable; import java.math.BigDecimal; @Transient import java.text.DateFormat; public int getNights() import java.util.Date; { return (int) ( checkoutDate.getTime() - checkinDate.getTime() ) / import javax.persistence.Basic; 1000 / 60 / 60 / 24; import javax.persistence.Entity; } import javax.persistence.GeneratedValue; import javax.persistence.Id; @Id @GeneratedValue import javax.persistence.ManyToOne; public Long getId() import javax.persistence.Temporal; { import javax.persistence.TemporalType; return id; import javax.persistence.Transient; } public void setId(Long id) import org.hibernate.validator.Length; { import org.hibernate.validator.NotNull; this.id = id; import org.hibernate.validator.Pattern; } import org.jboss.seam.annotations.Name; @NotNull @Entity @Basic @Temporal(TemporalType.DATE) @Name("booking") public Date getCheckinDate() public class Booking implements Serializable { { return checkinDate; private Long id; } private User user; public void setCheckinDate(Date datetime) private Hotel hotel; { private Date checkinDate; this.checkinDate = datetime; private Date checkoutDate; } private String creditCard; private String creditCardName; @ManyToOne @NotNull private int creditCardExpiryMonth; public Hotel getHotel() private int creditCardExpiryYear; { private boolean smoking; return hotel; private int beds; } public void setHotel(Hotel hotel) public Booking() {} { this.hotel = hotel; public Booking(Hotel hotel, User user) } { this.hotel = hotel; @ManyToOne @NotNull this.user = user; public User getUser() } { return user; } Tuesday, September 8, 2009
  • 79. public int getBeds() public void setUser(User user) { { return beds; this.user = user; } } public void setBeds(int beds) @Basic @Temporal(TemporalType.DATE) { @NotNull this.beds = beds; public Date getCheckoutDate() } { @NotNull(message="Credit card name is required") return checkoutDate; @Length(min=3, max=70, message="Credit card name is required") } public String getCreditCardName() public void setCheckoutDate(Date checkoutDate) { { return creditCardName; this.checkoutDate = checkoutDate; } } public void setCreditCardName(String creditCardName) @NotNull(message="Credit card number is required") { @Length(min=16, max=16, message="Credit card number must 16 digits long") this.creditCardName = creditCardName; @Pattern(regex="^d*$", message="Credit card number must be numeric") } public String getCreditCard() { public int getCreditCardExpiryMonth() return creditCard; { } return creditCardExpiryMonth; } public void setCreditCard(String creditCard) { public void setCreditCardExpiryMonth(int creditCardExpiryMonth) this.creditCard = creditCard; { } this.creditCardExpiryMonth = creditCardExpiryMonth; } @Transient public String getDescription() public int getCreditCardExpiryYear() { { DateFormat df = DateFormat.getDateInstance(DateFormat.MEDIUM); return creditCardExpiryYear; return hotel==null ? null : hotel.getName() + } ", " + df.format( getCheckinDate() ) + " to " + df.format( getCheckoutDate() ); public void setCreditCardExpiryYear(int creditCardExpiryYear) } { this.creditCardExpiryYear = creditCardExpiryYear; public boolean isSmoking() } { return smoking; @Override } public String toString() { public void setSmoking(boolean smoking) return "Booking(" + user + ","+ hotel + ")"; { } this.smoking = smoking; } } Tuesday, September 8, 2009
  • 80. class Booking < ActiveRecord::Base belongs_to :hotel belongs_to :user validates_presence_of :hotel validates_presence_of :user validates_presence_of :credit_card validates_presence_of :credit_card_name validates_length_of :credit_card, :within => 16..16 validates_format_of :credit_card, :with => /^d*$/ validates_length_of :credit_card_name, :within => 3..70 def total hotel.price * nights end def nights ((checkout_date - checkin_date) / 1.day).round end def to_s "Booking(#{user},#{hotel})" end end Tuesday, September 8, 2009
  • 81. class Booking < ActiveRecord::Base belongs_to :hotel belongs_to :user validates_presence_of :hotel validates_presence_of :user validates_presence_of :credit_card validates_presence_of :credit_card_name validates_length_of :credit_card, :within => 16..16 validates_format_of :credit_card, :with => /^d*$/ validates_length_of :credit_card_name, :within => 3..70 def total hotel.price * nights end def nights ((checkout_date - checkin_date) / 1.day).round end def to_s "Booking(#{user},#{hotel})" end end Tuesday, September 8, 2009
  • 82. class CreateBookings < ActiveRecord::Migration def self.up create_table :bookings do |t| t.references :user t.references :hotel t.datetime :checkin t.datetime :checkout t.string :credit_card t.string :credit_card_name t.integer :credit_card_expiry_month t.integer :credit_card_expiry_year t.boolean :smoking t.integer :beds t.timestamps end end def self.down drop_table :bookings end end Tuesday, September 8, 2009
  • 83. class CreateBookings < ActiveRecord::Migration def self.up create_table :bookings do |t| t.references :user t.references :hotel t.datetime :checkin t.datetime :checkout t.string :credit_card t.string :credit_card_name t.integer :credit_card_expiry_month t.integer :credit_card_expiry_year t.boolean :smoking t.integer :beds t.timestamps end end def self.down drop_table :bookings end end Tuesday, September 8, 2009
  • 84. class CreateBookings < ActiveRecord::Migration def self.up create_table :bookings do |t| t.references :user t.references :hotel t.datetime :checkin t.datetime :checkout t.string :credit_card t.string :credit_card_name t.integer :credit_card_expiry_month t.integer :credit_card_expiry_year t.boolean :smoking t.integer :beds t.timestamps end end def self.down drop_table :bookings end end Tuesday, September 8, 2009
  • 85. 190 vs 40 Tuesday, September 8, 2009
  • 86. “Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em 20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante, facilitou a dificuldade que tinham em manutenção. Eles também finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores. Uma vez completo e otimizado, o site deles agora é mais rápido que antes.” http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails Tuesday, September 8, 2009
  • 87. “Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em 20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante, facilitou a dificuldade que tinham em manutenção. Eles também finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores. Uma vez completo e otimizado, o site deles agora é mais rápido que antes.” http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails Tuesday, September 8, 2009
  • 88. “Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em 20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante, facilitou a dificuldade que tinham em manutenção. Eles também finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores. Uma vez completo e otimizado, o site deles agora é mais rápido que antes.” http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails Tuesday, September 8, 2009
  • 89. “Eles servem mais de 23 milhões de visitantes/mês. A conversão resultou em 20 mil linhas de Ruby em vez de 125 mil linhas de Java e, mais importante, facilitou a dificuldade que tinham em manutenção. Eles também finalizaram a reescrita do sistema em apenas 3 meses com 4 desenvolvedores. Uma vez completo e otimizado, o site deles agora é mais rápido que antes.” http://www.railsonwave.com/railsonwave/2008/6/4/yellowpages-com-migrates-to-rails Tuesday, September 8, 2009
  • 90. Ferramentas Ágeis Tuesday, September 8, 2009
  • 91. Gitorious Repositórios Github Integração Integrity Contínua Cruise Control Capistrano Deployment Puppet Monitoramento New Relic Tuesday, September 8, 2009
  • 92. Gitorious Repositórios Github Integração Integrity Contínua Cruise Control Capistrano Deployment Puppet Monitoramento New Relic Tuesday, September 8, 2009
  • 93. Gitorious Repositórios Github Integração Integrity Contínua Cruise Control Capistrano Deployment Puppet Monitoramento New Relic Tuesday, September 8, 2009
  • 94. Gitorious Repositórios Github Integração Integrity Contínua Cruise Control Capistrano Deployment Puppet Monitoramento New Relic Tuesday, September 8, 2009
  • 96. peepcode.com Geoffrey Tuesday, September 8, 2009
  • 97. railsenvy.com Jason e Gregg Tuesday, September 8, 2009
  • 98. railscasts.com Ryan Bates Tuesday, September 8, 2009
  • 99. rubylearning.org Satish Talim Tuesday, September 8, 2009
  • 100. rubyinside.com.br Peter Cooper Tuesday, September 8, 2009
  • 106. O que dizem por aí ... Tuesday, September 8, 2009
  • 114. Rails não Escala Tuesday, September 8, 2009
  • 117. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Tuesday, September 8, 2009
  • 118. Para colocar as coisas em perspectiva, o Friendster foi escrito em Java e eles mudaram para PHP. MySpace foi escrito em ColdFusion e eles mudaram para ASP.NET. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Tuesday, September 8, 2009
  • 119. Para colocar as coisas em perspectiva, o Friendster foi escrito em Java e eles mudaram para PHP. MySpace foi escrito em ColdFusion e eles mudaram para ASP.NET. Quando as pessoas caem em problemas de escalabilidade, normalmente acham que a linguagem é o problema, mas eu acho que isso raramente é a realidade. Blaine Cook http://www.akitaonrails.com/2008/6/17/chatting-with-blaine-cook-twitter Tuesday, September 8, 2009
  • 120. “O The New York Times usou Ruby on Rails para agregar, analizar e mostrar os resultados das eleições em quase tempo real em um de seus sites mais acessados de todos os tempos.” http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1 Tuesday, September 8, 2009
  • 121. “O The New York Times usou Ruby on Rails para agregar, analizar e mostrar os resultados das eleições em quase tempo real em um de seus sites mais acessados de todos os tempos.” http://www.computerworld.com.au/article/268003/ruby_rails_rolls_into_enterprise?fp=16&fpid=1 Tuesday, September 8, 2009
  • 122. Ruby é Lento Tuesday, September 8, 2009
  • 123. x mais lento que C++ Tuesday, September 8, 2009
  • 124. x mais lento que C++ 0 50 100 Python 2 150 Ruby 1.9 200 Perl JRuby Python 3 PHP Ruby 1.8.6 Tuesday, September 8, 2009
  • 125. Homepage: 331 ms Tuesday, September 8, 2009
  • 126. Homepage: 331 ms Total: 5.45 s Tuesday, September 8, 2009
  • 128. Performance != Escalabilidade Tuesday, September 8, 2009
  • 131. Mais Produtivo “Melhor” Anti-legado Tuesday, September 8, 2009
  • 132. Mais Produtivo “Melhor” Anti-legado Tuesday, September 8, 2009
  • 133. Mais Produtivo “Melhor” Anti-legado Tuesday, September 8, 2009
  • 136. Robert C. Martin Tuesday, September 8, 2009
  • 140. Test Driven Development Tuesday, September 8, 2009
  • 142. describe BankAccount do before :each do @bank_account = BankAccount.new :balance => 250 end it "should not be valid" do @bank_account.should be_valid end it "should transfer funds successfully" do @bank_account.should_receive(:transfer) .with_args(:amount => 100) .and_return(true) @bank_account.execute_transaction(:amount => 100) @bank_account.balance.should == 150 end end Tuesday, September 8, 2009
  • 143. describe BankAccount do before :each do @bank_account = BankAccount.new :balance => 250 end it "should not be valid" do @bank_account.should be_valid end it "should transfer funds successfully" do @bank_account.should_receive(:transfer) .with_args(:amount => 100) .and_return(true) @bank_account.execute_transaction(:amount => 100) @bank_account.balance.should == 150 end end Tuesday, September 8, 2009
  • 144. describe BankAccount do before :each do @bank_account = BankAccount.new :balance => 250 end it "should not be valid" do @bank_account.should be_valid end it "should transfer funds successfully" do @bank_account.should_receive(:transfer) .with_args(:amount => 100) .and_return(true) @bank_account.execute_transaction(:amount => 100) @bank_account.balance.should == 150 end end Tuesday, September 8, 2009
  • 145. describe BankAccount do before :each do @bank_account = BankAccount.new :balance => 250 end it "should not be valid" do @bank_account.should be_valid end it "should transfer funds successfully" do @bank_account.should_receive(:transfer) .with_args(:amount => 100) .and_return(true) @bank_account.execute_transaction(:amount => 100) @bank_account.balance.should == 150 end end Tuesday, September 8, 2009
  • 147. Funcionalidade: Adição Para evitar erros bobos Como um péssimo matemático Eu quero saber como somar dois números Cenário: Adicionar dois números Dado que eu digitei 50 na calculadora E que eu digitei 70 na calculadora Quando eu aperto o botão de soma Então o resultado na calculadora deve ser 120 Tuesday, September 8, 2009
  • 148. Funcionalidade: Adição Para evitar erros bobos Como um péssimo matemático Eu quero saber como somar dois números Cenário: Adicionar dois números Dado que eu digitei 50 na calculadora E que eu digitei 70 na calculadora Quando eu aperto o botão de soma Então o resultado na calculadora deve ser 120 Tuesday, September 8, 2009
  • 151. Não é mais demorado? Tuesday, September 8, 2009
  • 152. Cowboy Profissional Tuesday, September 8, 2009
  • 153. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 154. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 155. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 156. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 157. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 158. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 159. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 160. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 161. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 162. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 163. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 164. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 165. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 166. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 167. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 168. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 169. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 170. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 171. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 172. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 173. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 174. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 175. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 176. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 177. Cowboy Profissional 70.00 52.50 Produtividade 35.00 17.50 0 1 2 3 4 5 6 7 8 9 10 11 12 Tempo Tuesday, September 8, 2009
  • 180. 237 Equipes 137 Finalizadas Tuesday, September 8, 2009
  • 182. Empreendedorismo Código e “Forma” Ciclo de Vida de Projetos Comunidade Open Source Tuesday, September 8, 2009
  • 183. Empreendedorismo Código e “Forma” Ciclo de Vida de Projetos Comunidade Open Source Tuesday, September 8, 2009
  • 184. Empreendedorismo Código e “Forma” Ciclo de Vida de Projetos Comunidade Open Source Tuesday, September 8, 2009
  • 185. Empreendedorismo Código e “Forma” Ciclo de Vida de Projetos Comunidade Open Source Tuesday, September 8, 2009
  • 188. Obrigado! akitaonrails.com railssummit.com.br Tuesday, September 8, 2009