67
Desenvolvimento Ágil com Ruby on Rails segunda-feira, 29 de abril de 13

Desenvolvimento Ágil com Ruby on Rails

Embed Size (px)

DESCRIPTION

Nesta palestra passaremos uma breve introdução a Ruby e apresentarei como o Ruby on Rails favorece a produtividade no desenvolvimento de aplicações Web.

Citation preview

  • Desenvolvimento gil com Ruby on

    Rails

    segunda-feira, 29 de abril de 13

  • http://bit.ly/agile-webdev-rails

    segunda-feira, 29 de abril de 13

    http://pragprog.com/book/rails4/agile-web-development-with-railshttp://pragprog.com/book/rails4/agile-web-development-with-rails
  • segunda-feira, 29 de abril de 13

  • segunda-feira, 29 de abril de 13

  • "Programmers should always be interested in

    learning new languages, preferably from an

    unfamiliar paradigm"

    "97 Things Every Programmer Should Know"

    segunda-feira, 29 de abril de 13

  • segunda-feira, 29 de abril de 13

  • Ruby on Rails um framework em Ruby

    segunda-feira, 29 de abril de 13

  • https://www.ruby-toolbox.com/categories/web_app_frameworks

    Sinatra, Padrino, Merb, Espresso

    segunda-feira, 29 de abril de 13

    https://www.ruby-toolbox.com/categories/web_app_frameworkshttps://www.ruby-toolbox.com/categories/web_app_frameworks
  • Conhecendo um pouco de Ruby

    segunda-feira, 29 de abril de 13

  • Ruby From Other Languages

    http://bit.ly/ruby-from-other

    segunda-feira, 29 de abril de 13

    http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/http://www.ruby-lang.org/en/documentation/ruby-from-other-languages/
  • Interpretado

    #app.rbputs Meet2Brains

    $ ruby app.rbMeet2Brains

    segunda-feira, 29 de abril de 13

  • Uso de Blocos

    my_list = [1,2,3,4,5]

    my_list.each do |item| # deal with itemend

    segunda-feira, 29 de abril de 13

  • Tudo tem valor

    x = 10y = 11

    z = if x < y 1else 2end

    z # => 1

    segunda-feira, 29 de abril de 13

  • Tudo objeto10.times{ |n| puts n }

    segunda-feira, 29 de abril de 13

  • Tudo objeto10.times{ |n| puts n }

    10.class=> Fixnum

    segunda-feira, 29 de abril de 13

  • Tudo objeto10.times{ |n| puts n }

    10.class=> Fixnum

    Fixnum.class=> Class

    segunda-feira, 29 de abril de 13

  • Tudo objeto10.times{ |n| puts n }

    10.class=> Fixnum

    Fixnum.class=> Class

    Fixnum.ancestors=> [Fixnum, Integer, Numeric, Comparable, Object, Kernel, BasicObject]

    segunda-feira, 29 de abril de 13

  • # This1 + 2# Is the same as this ...1.+(2)# Which is the same as this:1.send "+", 2

    segunda-feira, 29 de abril de 13

  • # This1 + 2# Is the same as this ...1.+(2)# Which is the same as this:1.send "+", 2

    segunda-feira, 29 de abril de 13

  • Metaprogramao

    segunda-feira, 29 de abril de 13

  • segunda-feira, 29 de abril de 13

  • class Car def inspect Cheap car endend

    segunda-feira, 29 de abril de 13

  • class Car def inspect Cheap car endend

    other_car = Car.newother_car.inspect # => Cheap car

    segunda-feira, 29 de abril de 13

  • class Car def inspect Cheap car endend

    other_car = Car.newother_car.inspect # => Cheap car

    segunda-feira, 29 de abril de 13

  • class Car def inspect Cheap car endend

    porsche = Car.newporsche.inspect # => Cheap car

    def porsche.inspect Expensive carend

    porsche.inspect # => Expensive car

    other_car = Car.newother_car.inspect # => Cheap car

    segunda-feira, 29 de abril de 13

  • class Car def inspect Cheap car endend

    porsche = Car.newporsche.inspect # => Cheap car

    def porsche.inspect Expensive carend

    porsche.inspect # => Expensive car

    other_car = Car.newother_car.inspect # => Cheap car

    segunda-feira, 29 de abril de 13

  • class Fixnum def hours self * 3600 # number of seconds/hour end alias hour hoursend

    # 14 hours from 00:00 January 1stTime.mktime(2006, 01, 01) + 14.hours # => Sun Jan 01 14:00:00

    segunda-feira, 29 de abril de 13

  • class Fixnum def hours self * 3600 # number of seconds/hour end alias hour hoursend

    # 14 hours from 00:00 January 1stTime.mktime(2006, 01, 01) + 14.hours # => Sun Jan 01 14:00:00

    Time.mktime(2006, 01, 01) + 14.hours # => Sun Jan 01 14:00:00

    segunda-feira, 29 de abril de 13

  • class Fixnum def hours self * 3600 # number of seconds/hour end alias hour hoursend

    # 14 hours from 00:00 January 1stTime.mktime(2006, 01, 01) + 14.hours # => Sun Jan 01 14:00:00

    Time.mktime(2006, 01, 01) + 14.hours # => Sun Jan 01 14:00:00

    segunda-feira, 29 de abril de 13

  • Time.now + 2.days# => 2013-05-01 12:40:57 -0300

    #Rails

    segunda-feira, 29 de abril de 13

  • Time.now + 2.days# => 2013-05-01 12:40:57 -0300

    #Rails

    segunda-feira, 29 de abril de 13

  • segunda-feira, 29 de abril de 13

  • Dica?

    segunda-feira, 29 de abril de 13

  • http://tryruby.org

    segunda-feira, 29 de abril de 13

    http://tryruby.org/http://tryruby.org/
  • RubyGems

    segunda-feira, 29 de abril de 13

  • Software Package

    segunda-feira, 29 de abril de 13

  • AutenticaoPaginaoImagensTasksFilas...

    segunda-feira, 29 de abril de 13

  • segunda-feira, 29 de abril de 13

  • $ gem install rails

    segunda-feira, 29 de abril de 13

  • $ gem install rails

    segunda-feira, 29 de abril de 13

  • Ruby on Rails

    segunda-feira, 29 de abril de 13

  • Agil

    segunda-feira, 29 de abril de 13

  • MVCsegunda-feira, 29 de abril de 13

  • Rails Philosophy

    segunda-feira, 29 de abril de 13

  • Dont Repeat Yourself (DRY)

    segunda-feira, 29 de abril de 13

  • Layouts, Views, Partials

    segunda-feira, 29 de abril de 13

  • Layouts, Views, Partials# application.html.erb

  • Layouts, Views, Partials# application.html.erb

  • HelpersFORMS, TAGS, HTML BLOCKS, SUPPORT, FORMATS, ...

    segunda-feira, 29 de abril de 13

  • HelpersFORMS, TAGS, HTML BLOCKS, SUPPORT, FORMATS, ...

    segunda-feira, 29 de abril de 13

  • Model - Scope

    segunda-feira, 29 de abril de 13

  • Model - Scope

    @published = Post.where(published: true)

    segunda-feira, 29 de abril de 13

  • Model - Scope

    @published = Post.where(published: true)

    class Post < ActiveRecord::Base scope :published, where(published: true)end

    segunda-feira, 29 de abril de 13

  • Model - Scope

    @published = Post.where(published: true)

    class Post < ActiveRecord::Base scope :published, where(published: true)end

    @published = Post.published

    segunda-feira, 29 de abril de 13

  • Convention over Configuration (CoC)

    segunda-feira, 29 de abril de 13

  • 123456789101112131415161718192021

    #config/routes.rbresources :posts

    #app/controllers/posts_controller.rbclass PostsController < ApplicationController

    def index @posts = Post.published end

    # ...end

    #app/views/posts/index.html.erbPosts

    #app/views/posts/_post.html.erb

    segunda-feira, 29 de abril de 13

  • RESTful

    segunda-feira, 29 de abril de 13

  • resources :photos

    segunda-feira, 29 de abril de 13

  • Migrations

    Migrations are a convenient way for you to alter your database in a structured and organized manner

    segunda-feira, 29 de abril de 13

  • class CreateProducts < ActiveRecord::Migrationdef upcreate_table :products do |t|t.string :namet.text :descriptiont.timestampsendenddef downdrop_table :productsendend

    segunda-feira, 29 de abril de 13

  • TestesTDD, BDD

    segunda-feira, 29 de abril de 13

  • Extensvel

    Autenticao, paginao, manipulao/upload de imagens, webservice, privilgios, pdf, csv, xml, json, filas,

    monitoramento, database drivers, ...

    segunda-feira, 29 de abril de 13

  • Quem usa?

    segunda-feira, 29 de abril de 13

  • www.adena.com.br

    segunda-feira, 29 de abril de 13

    http://www.giran.com/brhttp://www.giran.com/br
  • http://rubyonrails.org/applications

    segunda-feira, 29 de abril de 13

    http://rubyonrails.org/applicationshttp://rubyonrails.org/applications
  • Referncias

    http://bit.ly/ZV7NLZ

    segunda-feira, 29 de abril de 13

    http://bit.ly/ZV7NLZhttp://bit.ly/ZV7NLZ
  • segunda-feira, 29 de abril de 13