Slide 1

Slide 1 text

Rails3 step off of the golden path RailsConf2009 - matt aimonetti Wednesday, May 6, 2009

Slide 2

Slide 2 text

WHO AM I? m a t t a i m o n e t t i Wednesday, May 6, 2009

Slide 3

Slide 3 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Wednesday, May 6, 2009

Slide 4

Slide 4 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Ted Han Wednesday, May 6, 2009

Slide 5

Slide 5 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Ted Han Ruby Addict Wednesday, May 6, 2009

Slide 6

Slide 6 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Ted Han Merb Ruby Addict Wednesday, May 6, 2009

Slide 7

Slide 7 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Ted Han Merb Rails Ruby Addict Wednesday, May 6, 2009

Slide 8

Slide 8 text

WHO AM I? m a t t a i m o n e t t i “morally loose, cheese eating surrender monkey” Ted Han Merb Rails MacRuby Ruby Addict Wednesday, May 6, 2009

Slide 9

Slide 9 text

Rails3 step off of the golden path RailsConf2009 - matt aimonetti Wednesday, May 6, 2009

Slide 10

Slide 10 text

MERGE Wednesday, May 6, 2009

Slide 11

Slide 11 text

Wednesday, May 6, 2009

Slide 12

Slide 12 text

Wednesday, May 6, 2009

Slide 13

Slide 13 text

Wednesday, May 6, 2009

Slide 14

Slide 14 text

RUBY oscon 2003 Wednesday, May 6, 2009

Slide 15

Slide 15 text

RUBY Wednesday, May 6, 2009

Slide 16

Slide 16 text

RUBY Wednesday, May 6, 2009

Slide 17

Slide 17 text

RUBY Wednesday, May 6, 2009

Slide 18

Slide 18 text

Wednesday, May 6, 2009

Slide 19

Slide 19 text

Wednesday, May 6, 2009

Slide 20

Slide 20 text

RUBY ON RAILS Convention over Configuration Don't repeat yourself Wednesday, May 6, 2009

Slide 21

Slide 21 text

LARGE ADOPTION Wednesday, May 6, 2009

Slide 22

Slide 22 text

SCHISM Wednesday, May 6, 2009

Slide 23

Slide 23 text

Performance Agnosticism Wednesday, May 6, 2009

Slide 24

Slide 24 text

Adobe Wikimedia sproutcore/Apple AT&T/yellowpages.com powerset/microsoft ... Wednesday, May 6, 2009

Slide 25

Slide 25 text

SPLIT RUBY COMMUNITY ... Wednesday, May 6, 2009

Slide 26

Slide 26 text

DRAMA ... Wednesday, May 6, 2009

Slide 27

Slide 27 text

SAT DOWN & TALKED ... Wednesday, May 6, 2009

Slide 28

Slide 28 text

DIFFERENT PERSPECTIVES Wednesday, May 6, 2009

Slide 29

Slide 29 text

SAME GOAL Wednesday, May 6, 2009

Slide 30

Slide 30 text

MERGE Wednesday, May 6, 2009

Slide 31

Slide 31 text

Wednesday, May 6, 2009

Slide 32

Slide 32 text

Wednesday, May 6, 2009

Slide 33

Slide 33 text

WHAT DO YOU GET? Wednesday, May 6, 2009

Slide 34

Slide 34 text

Wednesday, May 6, 2009

Slide 35

Slide 35 text

vaporware Wednesday, May 6, 2009

Slide 36

Slide 36 text

WHAT ARE YOU GOING TO GET improved performance Wednesday, May 6, 2009

Slide 37

Slide 37 text

WHAT ARE YOU GOING TO GET increased modularity Wednesday, May 6, 2009

Slide 38

Slide 38 text

WHAT ARE YOU GOING TO GET agnosticism Wednesday, May 6, 2009

Slide 39

Slide 39 text

WHAT ARE YOU GOING TO GET public API Wednesday, May 6, 2009

Slide 40

Slide 40 text

WHAT ARE YOU GOING TO GET mountable apps Wednesday, May 6, 2009

Slide 41

Slide 41 text

WHAT DOES IT REALLY MEAN? Rails 2 Wednesday, May 6, 2009

Slide 42

Slide 42 text

WHAT DOES IT REALLY MEAN? Rails 3 Wednesday, May 6, 2009

Slide 43

Slide 43 text

CECI N’EST PAS LA RÉALITÉ Rails 2 assert_equal(true, AwesomeApp.success?) html, xml, json, js Wednesday, May 6, 2009

Slide 44

Slide 44 text

CECI N’EST PAS LA RÉALITÉ Rails 2 assert_equal(true, AwesomeApp.success?) html, xml, json, js ERB Wednesday, May 6, 2009

Slide 45

Slide 45 text

CECI N’EST PAS LA RÉALITÉ Rails 2 assert_equal(true, AwesomeApp.success?) html, xml, json, js ERB Wednesday, May 6, 2009

Slide 46

Slide 46 text

CECI N’EST PAS LA RÉALITÉ Rails 2 assert_equal(true, AwesomeApp.success?) html, xml, json, js ActiveRecord ERB Wednesday, May 6, 2009

Slide 47

Slide 47 text

CECI N’EST PAS LA RÉALITÉ Rails 2 assert_equal(true, AwesomeApp.success?) html, xml, json, js ActiveRecord Test::Unit ERB Wednesday, May 6, 2009

Slide 48

Slide 48 text

RAILS 3 DEFAULT STACK • ORM: ActiveRecord • JS: Prototype • Templating: ERB • Testing: Test::Unit Wednesday, May 6, 2009

Slide 49

Slide 49 text

RAILS 3 - DEFAULT STACK assert_equal(true, AwesomeApp.success?) html, xml, json, js Wednesday, May 6, 2009

Slide 50

Slide 50 text

RAILS 3 - DEFAULT STACK assert_equal(true, AwesomeApp.success?) html, xml, json, js ERB Wednesday, May 6, 2009

Slide 51

Slide 51 text

RAILS 3 - DEFAULT STACK assert_equal(true, AwesomeApp.success?) html, xml, json, js ERB Wednesday, May 6, 2009

Slide 52

Slide 52 text

RAILS 3 - DEFAULT STACK assert_equal(true, AwesomeApp.success?) html, xml, json, js ActiveRecord ERB Wednesday, May 6, 2009

Slide 53

Slide 53 text

RAILS 3 - DEFAULT STACK assert_equal(true, AwesomeApp.success?) html, xml, json, js ActiveRecord Test::Unit ERB Wednesday, May 6, 2009

Slide 54

Slide 54 text

WHAAAT? Wednesday, May 6, 2009

Slide 55

Slide 55 text

NO DRASTIC CHANGES FOR THE END USERS Wednesday, May 6, 2009

Slide 56

Slide 56 text

RAILS WAY Wednesday, May 6, 2009

Slide 57

Slide 57 text

RAILS WAYS Wednesday, May 6, 2009

Slide 58

Slide 58 text

Wednesday, May 6, 2009

Slide 59

Slide 59 text

Wednesday, May 6, 2009

Slide 60

Slide 60 text

Wednesday, May 6, 2009

Slide 61

Slide 61 text

GAIN FLEXIBILTY Wednesday, May 6, 2009

Slide 62

Slide 62 text

LESS OPINIONATED Wednesday, May 6, 2009

Slide 63

Slide 63 text

WE ARE NOT ALL THE SAME Wednesday, May 6, 2009

Slide 64

Slide 64 text

Wednesday, May 6, 2009

Slide 65

Slide 65 text

¿WHEN? Wednesday, May 6, 2009

Slide 66

Slide 66 text

Use default stack? Rails 3 default stack Is there a reason not to use it? Y is it a question of taste? Use the default stack and stop overthinking things N Y is it worth it? Rails 3 custom stack evaluate your requirements: templating, JS, ORM, Performance N N Y is it worth it? Y N Wednesday, May 6, 2009

Slide 67

Slide 67 text

OPTIONS Wednesday, May 6, 2009

Slide 68

Slide 68 text

JAVASCRIPT FRAMEWORKS Wednesday, May 6, 2009

Slide 69

Slide 69 text

TEMPLATING ENGINES Wednesday, May 6, 2009

Slide 70

Slide 70 text

OBJECT RELATION MAPPER Wednesday, May 6, 2009

Slide 71

Slide 71 text

Databases Object Oriented Languages scalar values objects data ORM Wednesday, May 6, 2009

Slide 72

Slide 72 text

RAW SQL SELECT * FROM Book WHERE price > 100.00 ORDER BY title; Wednesday, May 6, 2009

Slide 73

Slide 73 text

ACTIVERECORD Book.all \ :conditions => ["price > ?", 100.00], :order => 'title' Wednesday, May 6, 2009

Slide 74

Slide 74 text

DATAMAPPER Book.all \ :price.gt => 100.00, :order => [:title.asc] Wednesday, May 6, 2009

Slide 75

Slide 75 text

SEQUEL Book.find{|b| b.price > 100.00}.order(:title) Wednesday, May 6, 2009

Slide 76

Slide 76 text

COUCHREST Book.by_price(:startkey => 100.01) Wednesday, May 6, 2009

Slide 77

Slide 77 text

MANY MORE ORMS/DSLS Wednesday, May 6, 2009

Slide 78

Slide 78 text

RUBY IS AWESOME Wednesday, May 6, 2009

Slide 79

Slide 79 text

DATAMAPPER Wednesday, May 6, 2009

Slide 80

Slide 80 text

DATAMAPPER @parent = Parent.find_by_name("Matt") @parent.children.each do |child| @parent.object_id.should == child.parent.object_id end Wednesday, May 6, 2009

Slide 81

Slide 81 text

DATAMAPPER @parent = Parent.find_by_name("Matt") @parent.children.each do |child| @parent.object_id.should == child.parent.object_id end Fails with ActiceRecord Wednesday, May 6, 2009

Slide 82

Slide 82 text

DATAMAPPER @parent = Parent.find_by_name("Matt") @parent.children.each do |child| @parent.object_id.should == child.parent.object_id end Fails with ActiceRecord Passes with DataMapper Wednesday, May 6, 2009

Slide 83

Slide 83 text

DATAMAPPER does what ActiveRecord does... but differently Wednesday, May 6, 2009

Slide 84

Slide 84 text

DATAMAPPER db drivers using 1 unified interface Copyright - Merb in Action - Manning Wednesday, May 6, 2009

Slide 85

Slide 85 text

DATAMAPPER • procrastination as a value • Lazy Loading • Strategic Eager Loader Wednesday, May 6, 2009

Slide 86

Slide 86 text

DATAMAPPER students = Student.all students.each do |student| student.books.map{|b| b.name} end Wednesday, May 6, 2009

Slide 87

Slide 87 text

ACTIVERECORD SELECT * FROM "students" SELECT * FROM "books" WHERE ("books".student_id = 1) SELECT * FROM "books" WHERE ("books".student_id = 2) SELECT * FROM "books" WHERE ("books".student_id = 3) SELECT * FROM "books" WHERE ("books".student_id = X) students = Student.all students.each do |student| student.books.map{|b| b.name} end Wednesday, May 6, 2009

Slide 88

Slide 88 text

DATAMAPPER students = Student.all students.each do |student| student.books.map{|b| b.name} end SELECT "id", "name" FROM "students" ORDER BY "id" SELECT "id", "name", "student_id" FROM "books" WHERE ("student_id" IN (1, 2, 3, X)) ORDER BY "id" Wednesday, May 6, 2009

Slide 89

Slide 89 text

MULTIPLE REPOS production: adapter: mysql encoding: utf8 database: production-app username: root password: top-s3ckrit host: localhost repositories: nightly_backup: adapter: sqlite3 database: shared/nightly.db weekly_backup: adapter: sqlite3 database: shared/weekly.db Wednesday, May 6, 2009

Slide 90

Slide 90 text

MULTIPLE REPOS Article.copy(:default, :nightly_backup, :created.gt => 1.day.ago ) Wednesday, May 6, 2009

Slide 91

Slide 91 text

MULTIPLE REPOS class Page include DataMapper::Resource property :id, Serial property :name, String repository(:legacy) do property :name, String, :field => "title" end end Wednesday, May 6, 2009

Slide 92

Slide 92 text

QUERY::PATH Person.all("addresses.street.like" => "%street%" ) SELECT "people"."id", "people"."name" FROM "people" INNER JOIN "addresses" ON ("people"."id" = "addresses"."person_id") WHERE ("addresses"."street" LIKE '%street%') ORDER BY "people"."id" Find all people with an address that has street in the street name Wednesday, May 6, 2009

Slide 93

Slide 93 text

ADAPTERS RDBMS file system IMAP Sales Force YAML REST APIs custom APIs ... Wednesday, May 6, 2009

Slide 94

Slide 94 text

SEQUEL • Prepared Statements • Sharding • highly customizable SQL work • high performance Wednesday, May 6, 2009

Slide 95

Slide 95 text

HIBERNATE • ActionORM • JRuby Wednesday, May 6, 2009

Slide 96

Slide 96 text

NON RDBMS SYSTEMS • AppEngine::Datastore • CouchDB with CouchRest or other DSL • Redis, Tokyo Cabinet etc... Wednesday, May 6, 2009

Slide 97

Slide 97 text

RAILS EXTREME only for a few of you Wednesday, May 6, 2009

Slide 98

Slide 98 text

CUSTOMIZE RAILS TO THE EXTREME Wednesday, May 6, 2009

Slide 99

Slide 99 text

CREATE YOUR OWN RAILS • define your own file structure • define your own router DSL • define your own ways to deal with requests Wednesday, May 6, 2009

Slide 100

Slide 100 text

EXTEND ACTIONCONTROLER class Presentation < ActionController::Http def index self.response_body = "Rails3 + MacRuby" end end Presentation.action(:index).call \ Rack::MockRequest.env_for("/railsconf10") Wednesday, May 6, 2009

Slide 101

Slide 101 text

EXTEND ACTIONCONTROLER def action(&blk) Class.new(ActionController::Http) do include ActionController::Renderer define_method(:xtreme, &blk) end.action(:xtreme) end run action do render "some_template" end Wednesday, May 6, 2009

Slide 102

Slide 102 text

¿FUTURE? Wednesday, May 6, 2009

Slide 103

Slide 103 text

+ + C o u c h D B Wednesday, May 6, 2009

Slide 104

Slide 104 text

credits: http://www.flickr.com/photos/dotdoubledot/ Katsushika Hokusai Delacroix Benetton http://www.rubyist.net/~matz/slides/oscon2003 Matt Groening http://www.flickr.com/photos/derricksphotos/ http://www.flickr.com/photos/bogdansuditu http://www.flickr.com/photos/77096872@N00/2547160291/ http://www.flickr.com/photos/edvvc/1972546648/ http://www.flickr.com/photos/amagill/34762677/ http://www.flickr.com/photos/celinesphotographer/360918623/ Wednesday, May 6, 2009

Slide 105

Slide 105 text

Thanks Heidi Vega Rails team Yehuda Katz Carl Lerche Laurent Sansonetti Rich Kilmer Ninh Hernandez Bui Hongli not-so-MacLovin’ Lai Dan Kubb Wednesday, May 6, 2009