09 - Fábio Akita - Além do rails
Upcoming SlideShare
Loading in...5
×
 

09 - Fábio Akita - Além do rails

on

  • 1,391 views

Ruby on Rails com certeza é a estrela que elevou Ruby ao patamar de linguagem praticamente obrigatória a todo programador moderno. Porém muitos esquecem que Rails não é a única forma de ...

Ruby on Rails com certeza é a estrela que elevou Ruby ao patamar de linguagem praticamente obrigatória a todo programador moderno. Porém muitos esquecem que Rails não é a única forma de desenvolver aplicações Web e muitas vezes nem é a melhor opção. O Ecossistema Ruby evolui a passos largos, todos os novos frameworks Web em Ruby adotaram o padrão Rack, que facilita a interoperabilidade entre frameworks Ruby. Além disso muitos estão olhando para o mundo da alta concorrência com novas tecnologias como Node.JS, mas o mundo Ruby tem opções robustas e testadas em produção como EventMachine. Enfim, vamos tentar aumentar o leque de soluções web com Ruby, além do Rails, traçando um paralelo com a plataforma .NET.

Statistics

Views

Total Views
1,391
Views on SlideShare
1,010
Embed Views
381

Actions

Likes
0
Downloads
12
Comments
0

1 Embed 381

http://dnad.dotnetarchitects.net 381

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    09 - Fábio Akita - Além do rails 09 - Fábio Akita - Além do rails Presentation Transcript

    • Discutindo Rails e Arquiteturas a apresentação já vai começar ...
    • Discutindo Rails e Arquiteturas
    • Fabio Akitawww.akitaonrails.com @akitaonrails
    • Fabio Akitawww.akitaonrails.com @akitaonrails 1990
    • Anos 80 Fim Anos 90 Século XXI
    • Anos 80 Fim Anos 90 Século XXI PerlBasic Pascal Java C PHP dBase Delphi Python ABAP III Ruby Clipper ASP .NET ObjC VB6
    • <prólogo>
    • Como o cliente Como o Líder de Como o Analista Como o Programador Como o Consultor de explicou Projeto entendeu desenhou escreveu Negócios descreveuComo o projeto foi Como Operações Como o cliente foi O que o cliente Como foi o suporte documentado instalou cobrado realmente queria
    • Requerimentos: ENTENDIDO!
    • LOL
    • DESIGN
    • DESIGN
    • Pattern PADRÃO
    • STANDARD Pattern PADRÃO Default
    • “Pattern”
    • NÃO é “Standard”!
    • Christopher Alexander
    • cada padrão (“pattern”)representa nosso melhor chute agora ... os padrões ainda são hipóteses, ... e portanto todos são tentativas, todos livres para evoluir sob o impacto de novas experiências e observações." Christopher Alexander
    • 2 + 2 = 5!
    • 2 + 2 = 5!
    • 2 + 2 = 4!
    • Aqui estão os fatos. Que Aqui está a conclusão. conclusões podemos Que fatos podemos chegar com eles? suportar com eles?
    • 80
    • 20 80
    • 20 80 “Long Tail”
    • </prólogo>
    • Pequenos (Startups?) Grandes(Enterprisey?)
    • Pequenos (Startups?)D DD Grandes (Enterprisey?)
    • Pequenos (Startups?) DD ”D ht Grandes“Lig (Enterprisey?)
    • Pequenos (Startups?) Grandes(Enterprisey?)
    • Complexidade Acidental
    • Ruby on Rails é a melhor forma de desenvolverqualquer aplicação Web.
    • Todas as outras formas de desenvolver aplicaçõesWeb são inferiores a Ruby on Rails.
    • Ruby on Rails é uma das maneiras competentesde se desenvolver aplicações Web em algunscenários.
    • 1994 (linguagem) 2004(framework web)
    • 1.8.7 1.9.21.9.3-dev 2.3.11 3.0.73.1-RC1
    • 1.8.7 1.9.21.9.3-dev 2.3.11 3.0.73.1-RC1
    • 1.8.7 1.9.21.9.3-dev 2.3.11 3.0.73.1-RC1
    • 1.8.7 1.9.21.9.3-dev 2.3.11 3.0.73.1-RC1
    • gem install railsrails new nome_do_projeto
    • gem install railsrails new nome_do_projeto
    • gem install railsrails new nome_do_projeto SIM! Via CLI! :-P
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Request Web Server Rack Middlewares Routes ControllerView Model
    • Response Request Web Server Rack Middlewares Routes Controller View Model
    • ~30 mil gems ~15 GB
    • bundle install
    • RubyGems Library Assembly (DLL) Rake MSBuild Bundler NuGet
    • > bundle listGems included by the bundle: * mail (2.2.19) * abstract (1.0.0) * mime-types (1.16) * actionmailer (3.0.7) * polyglot (0.3.1) * actionpack (3.0.7) * rack (1.2.2) * activemodel (3.0.7) * rack-mount (0.6.14) * activerecord (3.0.7) * rack-test (0.5.7) * activeresource (3.0.7) * rails (3.0.7) * activesupport (3.0.7) * railties (3.0.7) * arel (2.0.9) * rake (0.8.7) * builder (2.1.2) * sqlite3 (1.3.3) * bundler (1.0.13) * thor (0.14.6) * erubis (2.6.6) * treetop (1.4.9) * i18n (0.5.0) * tzinfo (0.3.27)
    • > bundle listGems included by the bundle: * mail (2.2.19) * abstract (1.0.0) * mime-types (1.16) * actionmailer (3.0.7) * polyglot (0.3.1) * actionpack (3.0.7) * rack (1.2.2) * activemodel (3.0.7) * rack-mount (0.6.14) * activerecord (3.0.7) * rack-test (0.5.7) * activeresource (3.0.7) * rails (3.0.7) * activesupport (3.0.7) * railties (3.0.7) * arel (2.0.9) * rake (0.8.7) * builder (2.1.2) * sqlite3 (1.3.3) * bundler (1.0.13) * thor (0.14.6) * erubis (2.6.6) * treetop (1.4.9) * i18n (0.5.0) * tzinfo (0.3.27)
    • > rake -T rake log:clearrake about rake middlewarerake db:create rake notesrake db:drop rake notes:customrake db:fixtures:load rake rails:templaterake db:migrate rake rails:updaterake db:migrate:status rake routesrake db:rollback rake secretrake db:schema:dump rake statsrake db:schema:load rake testrake db:seed rake test:recentrake db:setup rake test:uncommittedrake db:structure:dump rake time:zones:allrake db:version rake tmp:clearrake doc:app rake tmp:create
    • > rails generateUsage: rails generate GENERATOR [args] [options]General options: -h, [--help] # Print generators options and usage -p, [--pretend] # Run but do not make any changes -f, [--force] # Overwrite files that already exist -s, [--skip] # Skip files that already exist -q, [--quiet] # Suppress status outputPlease choose a generator below.Rails: observer controller performance_test generator plugin helper resource integration_test scaffold mailer scaffold_controller migration session_migration model stylesheets
    • > rake middleware Rack Middlewaresuse ActionDispatch::Staticuse Rack::Lockuse ActiveSupport::Cache::Strategy::LocalCacheuse Rack::Runtimeuse Rails::Rack::Loggeruse ActionDispatch::ShowExceptionsuse ActionDispatch::RemoteIpuse Rack::Sendfileuse ActionDispatch::Callbacksuse ActiveRecord::ConnectionAdapters::ConnectionManagementuse ActiveRecord::QueryCacheuse ActionDispatch::Cookiesuse ActionDispatch::Session::CookieStoreuse ActionDispatch::Flashuse ActionDispatch::ParamsParseruse Rack::MethodOverrideuse ActionDispatch::Headuse ActionDispatch::BestStandardsSupportrun Demo::Application.routes
    • Response Request Web Server Rack Middlewares Routes Controller View Model
    • Response Request Web Server Rack Middlewares Routes Controller View Model
    • Response Request Web Server Application Rack Middlewares Server Rack: Mongrel, Routes Thin, Passenger, Controller Unicorn View Model
    • Web Server: NginXResponse Request Apache Web Server Application Rack Middlewares Server Rack: Mongrel, Routes Thin, Passenger, Controller Unicorn View Model
    • NginX, Apache, Lighty, IIS Reverse ProxyMongrel, Thin, Unicorn, Passenger ActiveRecord/DataMapper RDBMS/NoSQL
    • NginX, Apache, Lighty, IIS Reverse ProxyMongrel, Thin, Unicorn, Passenger TidyTDS ActiveRecord/DataMapper SQL Server SQL Azure RDBMS/NoSQL
    • NginX, Apache, Lighty, IIS Reverse ProxyMongrel, Thin, Unicorn, Passenger ActiveRecord/DataMapperActiveResource/RestClient/Savon WCF RDBMS/NoSQL Web Services (REST, SOAP)
    • HAProxy NginX, Apache, Lighty, IIS Reverse ProxyMongrel, Thin, Unicorn, Passenger ActiveRecord/DataMapperActiveResource/RestClient/Savon RDBMS/NoSQL Web Services (REST, SOAP)
    • HAProxy NginX, Apache, Lighty, IIS Varnish Reverse ProxyMongrel, Thin, Unicorn, Passenger ActiveRecord/DataMapperActiveResource/RestClient/Savon RDBMS/NoSQL Web Services (REST, SOAP)
    • HAProxy NginX, Apache, Lighty, IIS Varnish Reverse ProxyMongrel, Thin, Unicorn, Passenger ActiveRecord/DataMapperActiveResource/RestClient/Savon Memcache RDBMS/NoSQL Web Services (REST, SOAP)
    • Request Request Request Request Request RequestHTTPD HTTPD HTTPD HTTPD HTTPD HTTPD Rails Rails Rails Rails Rails Rails App App App App App App RDBMS
    • Request Request Request Request Request RequestHTTPD HTTPD HTTPD HTTPD HTTPD HTTPD Rails Rails Rails Rails Rails Rails App App App App App App RDBMS
    • Request Request Request Request Request RequestHTTPD HTTPD HTTPD HTTPD HTTPD HTTPD Rails Rails Rails Rails Rails Rails App App App App App App Mais curto RDBMS possível!
    • Thread Context Switch
    • Thread Context Switch
    • $(:checkbox).map(function() { return this.id;}).get().join(,);
    • RailsRequest App
    • Eventos AssíncronosEnvio de mensagens
    • Request Request Request Request Request RequestHTTPD HTTPD HTTPD HTTPD HTTPD HTTPD Rails Rails Rails Rails Rails Rails App App App App App App RDBMS
    • Request Request Request Request Request Request NginX Event Machine RDBMS
    • Request Request Request Request Request Request NginX Event Machine “Look Ma! No Threads!” RDBMS
    • Request Request Request Request Request Request NginX 5k ~ 10k conexões Event Machine “Look Ma! No Threads!” RDBMS
    • Request Request Request Request Request Request NginX 5k ~ 10k conexões Conexões Longas Event Machine “Look Ma! No Threads!” RDBMS
    • <script src="http://js.pusherapp.com/1.8/pusher.min.js"></script><script>var pusher = new Pusher(API_KEY);var myChannel = pusher.subscribe(MEU_CANAL);</script>
    • <script src="http://js.pusherapp.com/1.8/pusher.min.js"></script><script>var pusher = new Pusher(API_KEY);var myChannel = pusher.subscribe(MEU_CANAL);</script>
    • <script src="http://js.pusherapp.com/1.8/pusher.min.js"></script><script>var pusher = new Pusher(API_KEY);var myChannel = pusher.subscribe(MEU_CANAL);</script>
    • myChannel.bind(coisa-criada, function(thing) { alert(Uma coisa foi criada: + thing.name);});
    • myChannel.bind(coisa-criada, function(thing) { alert(Uma coisa foi criada: + thing.name);});
    • myChannel.bind(coisa-criada, function(thing) { alert(Uma coisa foi criada: + thing.name);});
    • require pusherPusher.app_id = APP_IDPusher.key = API_KEYPusher.secret = SECRET_KEYclass ThingsController < ApplicationController def create @thing = Thing.new(params[:thing]) if @thing.save Pusher[MEU_CANAL].trigger(coisa-criada, @thing.attributes) end endend
    • require pusherPusher.app_id = APP_IDPusher.key = API_KEYPusher.secret = SECRET_KEYclass ThingsController < ApplicationController def create @thing = Thing.new(params[:thing]) if @thing.save Pusher[MEU_CANAL].trigger(coisa-criada, @thing.attributes) end endend
    • require pusherPusher.app_id = APP_IDPusher.key = API_KEYPusher.secret = SECRET_KEYclass ThingsController < ApplicationController def create @thing = Thing.new(params[:thing]) if @thing.save Pusher[MEU_CANAL].trigger(coisa-criada, @thing.attributes) end endend
    • require pusherPusher.app_id = APP_IDPusher.key = API_KEYPusher.secret = SECRET_KEYclass ThingsController < ApplicationController def create @thing = Thing.new(params[:thing]) if @thing.save Pusher[MEU_CANAL].trigger(coisa-criada, @thing.attributes) end endend
    • Arquitetura deAltíssima Concorrência
    • (
    • W. Edward Deming
    • IN GOD WE TRUSTTodos os outros devem trazer dados
    • EXPERIENCE BY ITSELF BRINGS NOTHING
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C STANDARD
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C
    • Ciclo “Plan-Do-Check-Act” (melhoria contínua) P A D C
    • )
    • Perl
    • Python
    • PHP
    • Ruby
    • OMG!
    • 20112010200920082007 Ruby on Rails
    • 201120102009 2.0.52008 62007 Ruby on Rails 2.0.0
    • 201120102009 2.1.2 2.0.5 3 2.1.02008 62007 Ruby on Rails 2.0.0
    • 20112010 2.2.32009 2.1.2 4 2.2.0 2.0.5 3 2.1.02008 62007 Ruby on Rails 2.0.0
    • 2011 2.3.112010 2.2.3 122009 2.3.0 2.1.2 4 2.2.0 2.0.5 3 2.1.02008 62007 Ruby on Rails 2.0.0
    • 3.0.7 2.3.11 820112010 3.0.0 2.2.3 122009 2.3.0 2.1.2 4 2.2.0 2.0.5 3 2.1.02008 62007 Ruby on Rails 2.0.0
    • 3.0.72011 2.3.112010 3.0.0 2.2.32009 2.1.2 2.3.0 31 2.2.0 Versões! 2.0.5 2.1.020082007 Ruby on Rails 2.0.0
    • Request Web Server Rails App/public/stylesheets
    • Request Web ServerArquivosEstáticos Rails App /public/stylesheets
    • Variáveis$blue: #3bbfce;$margin: 16px; /* CSS */.content-navigation { .content-navigation { border-color: $blue; border-color: #3bbfce; color: color: #2b9eab; darken($blue, 9%); }} .border {.border { padding: 8px; padding: $margin / 2; margin: 8px; margin: $margin / 2; border-color: #3bbfce; border-color: $blue; }}
    • Nestingtable.hl { /* CSS */ margin: 2em 0; td.ln { table.hl { text-align: right; margin: 2em 0; } }} table.hl td.ln { text-align: right;li { } font: { family: serif; li { weight: bold; font-family: serif; size: 1.2em; font-weight: bold; } font-size: 1.2em;} }
    • Mixins@mixin table-base { th { /* CSS */ text-align: center; font-weight: bold; #data { } td, th {padding: 2px} float: left;} margin-left: 10px; }@mixin left($dist) { #data th { float: left; text-align: center; margin-left: $dist; font-weight: bold;} } #data td, #data th {#data { @include left(10px); padding: 2px; @include table-base; }}
    • Selector Inheritance /* CSS */.error { .error, .badError { border: 1px #f00; border: 1px #f00; background: #fdd; background: #fdd;} }.error.intrusion { font-size: 1.3em; .error.intrusion, font-weight: bold; .badError.intrusion {} font-size: 1.3em; font-weight: bold;.badError { } @extend .error; border-width: 3px; .badError {} border-width: 3px; }
    • class Animal constructor: (@name) -> move: (meters) -> alert @name + " moved " + meters + "m."class Snake extends Animal move: -> alert "Slithering..." super 5class Horse extends Animal move: -> alert "Galloping..." super 45sam = new Snake "Sammy the Python"tom = new Horse "Tommy the Palomino"sam.move()tom.move()
    • var Animal, Horse, Snake, sam, tom; var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor;class Animal child.__super__ = parent.prototype; constructor: (@name) -> return child; }; Animal = (function() { move: (meters) -> function Animal(name) { this.name = name; alert @name + " moved " + meters + "m." } Animal.prototype.move = function(meters) { return alert(this.name + " moved " + meters + "m.");class Snake extends Animal }; return Animal; move: -> })(); alert "Slithering..." Snake = (function() { __extends(Snake, Animal); super 5 function Snake() { Snake.__super__.constructor.apply(this, arguments); }class Horse extends Animal Snake.prototype.move = function() { alert("Slithering..."); move: -> return Snake.__super__.move.call(this, 5); alert "Galloping..." }; return Snake; super 45 })(); Horse = (function() { __extends(Horse, Animal);sam = new Snake "Sammy the Python" function Horse() {tom = new Horse "Tommy the Palomino" Horse.__super__.constructor.apply(this, arguments); } Horse.prototype.move = function() { alert("Galloping...");sam.move() return Horse.__super__.move.call(this, 45);tom.move() }; return Horse; })(); sam = new Snake("Sammy the Python"); tom = new Horse("Tommy the Palomino"); sam.move(); tom.move(); loadrun
    • 102
    • Request Request Web Server Web Server(Desenvolvimento) (Produção) Rails App /app/assets /public
    • Request Request Web Server Web Server(Desenvolvimento) (Produção) Rails Sprockets App /app/assets /public
    • Request Request Web Server Web Server(Desenvolvimento) (Produção) Rails Sprockets App Tilt /app/assets /public
    • Request Request Web Server Web Server(Desenvolvimento) (Produção) Rails Sprockets App Tilt Ugli er /app/assets /public
    • ENGINE FILE EXTENSIONS REQUIRED LIBRARIESERB .erb, .rhtml noneInterpolated String .strErubis .erb, .rhtml, .erubis erubisHaml .haml hamlSass .sass sassScss .scssLess CSS .less lessBuilder .builder builderLiquid .liquid liquidRDiscount rdiscountRedcarpet redcarpetBlueCloth .markdown, .mkd, .md blueclothKramdown kramdownMaruku marukuRedCloth .textile redclothRDoc .rdoc rdocRadius .radius radiusMarkaby .mab markabyNokogiri .nokogiri nokogiriCoffeeScript .coffee coffee-scriptCreole (Wiki markup) .creole creole
    • Rails 3.1:Release Candidate (may 2011)
    • RubyConf Brasil3 e 4 de Novembro www.rubyconf.com.br
    • <epílogo>
    • Pedro Franceschi @pedroh96
    • 15 anosPedro Franceschi @pedroh96
    • 9 anosPedro Franceschi @pedroh96
    • 6 anosPedro Franceschi @pedroh96
    • Pedro Franceschi @pedroh96
    • </epílogo>
    • Obrigado! www.akitaonrails.com u.akita.ws/dnad11 .com.br