Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy...

139
Battle Royale Battle Royale Merb's Role in the MVC Holy Wars

Transcript of Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy...

Page 1: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Battle RoyaleBattle RoyaleMerb's Role in the MVC Holy Wars

Page 2: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami

Page 3: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami● Foy Savas

Page 4: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami● Foy Savas● foysavas online (github, irc, twitter, etc)

Page 5: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami● Foy Savas● foysavas online (github, irc, twitter, etc)● Ruby Application Developer

Page 6: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami● Foy Savas● foysavas online (github, irc, twitter, etc)● Ruby Application Developer● Merb and DataMapper Contributor

Page 7: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

> whoami> whoami● Foy Savas● foysavas online (github, irc, twitter, etc)● Ruby Application Developer● Merb and DataMapper Contributor● Bet Dan Grigsby $20 we could patch Extlib

against some ridiculous edge case bug

Page 8: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Dan, you better pay up.Dan, you better pay up.

Page 9: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

The Merb WayThe Merb Way

Page 10: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 11: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

A way that can be taken rarely stays the way.A way that can be taken rarely stays the way.A name that can be given rarely stays the name.A name that can be given rarely stays the name.

Page 12: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks

Page 13: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS

Page 14: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP

Page 15: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP

Page 16: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP● Coldfusion

Page 17: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP● Coldfusion ● Bird's Nests of PHP

Page 18: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP● Coldfusion ● Bird's Nests of PHP● Ruby on Rails

Page 19: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP● Coldfusion ● Bird's Nests of PHP● Ruby on Rails● Django

Page 20: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Applies to Web FrameworksApplies to Web Frameworks● OpenACS● JSP● ASP● Coldfusion ● Bird's Nests of PHP● Ruby on Rails● Django

Page 21: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

class << your_mindclass << your_mind

Page 22: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

So what is Merb?So what is Merb?

Page 23: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb's Conceptual LineageMerb's Conceptual Lineage

Page 24: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 25: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

No WorriesNo Worriesthat was pretty much made up anyway.

Page 26: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

MerbMerb.first.first● Created by Ezra of EY● In under 120 LOC● Meant to do what Rails was

bad at: quick responses● Mongrel + ERB● Distributed as a pastie

Page 27: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

What is it now?What is it now?● High Performance● Quick to Deploy● Easy to Scale● Agile Web Framework● Available with a full stack● That's built to be modular so

that it can grow with your app

Page 28: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Sounds a lot like RailsSounds a lot like Rails

Page 29: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

It is.It is.

Page 30: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

AwesomeAwesome

Page 31: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Questions?Questions?

Page 32: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Yeah, what would happen if you lock them up in a Yeah, what would happen if you lock them up in a death match cage – you know, 2 enter, 1 leave style?death match cage – you know, 2 enter, 1 leave style?

Page 33: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Bloody goodquestion.

Page 34: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Well... they're not humanWell... they're not human

Page 35: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 36: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Humans Humans =>=> Frameworks Frameworks● Physical Power● Fighting Techniques● Previous Fighting Experience● Crowd Appeal● Coaches and Trainers

● Application Performance● Stack Features● Proven Production Apps● Marketability● Development Team

Page 37: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 38: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

{{

Page 39: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Application PerformanceApplication Performance

Page 40: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 41: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Rails & MerbRails & MerbEat Cake For BreakfastEat Cake For Breakfast

Page 42: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

But Merb Still Blazes AheadBut Merb Still Blazes Ahead

Page 43: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 44: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 45: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 46: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Symbol#to_procSymbol#to_proc

Page 47: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Symbol#to_procSymbol#to_proc● Commonly used in Rails

– all over ActionPack and ActiveRecord● filter_chain.select(&:before?).map(&:method)

Page 48: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Symbol#to_procSymbol#to_proc● Commonly used in Rails

– all over ActionPack and ActiveRecord● filter_chain.select(&:before?).map(&:method)

● Considered evil in Merb due to performance costs.– but also because its been a non-standard not-so-readable idiom– Merb doesn't stop you from using it in your own apps, but recognizes

micro-performance adds up especially at the framework level

Page 49: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 50: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

A microsecond saved,A microsecond saved, is a microsecond earned. is a microsecond earned.

Page 51: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 52: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 53: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

templates and ivarstemplates and ivars

Page 54: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

templates and ivarstemplates and ivars● Rails uses instance variables in templates

Page 55: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

templates and ivarstemplates and ivars● Rails uses instance variables in templates

– Painstakingly copies them over from the controller to the view● @assigns.each { |key, value| instance_variable_set("@#{key}", value) }

Page 56: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

templates and ivarstemplates and ivars● Rails uses instance variables in templates

– Painstakingly copies them over from the controller to the view● @assigns.each { |key, value| instance_variable_set("@#{key}", value) }

● Merb loves you

Page 57: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

templates and ivarstemplates and ivars● Rails uses instance variables in templates

– Painstakingly copies them over from the controller to the view● @assigns.each { |key, value| instance_variable_set("@#{key}", value) }

● Merb loves you– Inlines templates into controller as methods.

● ivar access through templates is natural, not contrived● some serious performance gains

Page 58: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

No codeNo codeis faster than no code.is faster than no code.

Page 59: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb Performance PromiseMerb Performance Promise● No stable release of Merb is

slower than the last.

Page 60: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb Performance PromiseMerb Performance Promise● No stable release of Merb is

slower than the last.● Ezra says heads will roll if it's

not upheld.

Page 61: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Stack FeaturesStack Features

Page 62: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 63: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Abstract ControllerAbstract Controller● Because not everything is a web controller, you know?● Used extensively

– Exception Controller– Mail Controller– More in later slides...

Page 64: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

No Double RendersNo Double Renders● Controller#render is just method that returns a string

– clean Ruby that's idiomatically sane● the value a controller action return is the response

– far easier to understand– far easier to work with

Page 65: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

display and providesdisplay and provides● Rails uses respond_to

– ew...● We just use case statements

– Thanks to the the clean implementation of controller actions in Merb● But we could also use the display method

– sends an serialized object in the appropriate formats provided– or alternatively a rendered template if available

Page 66: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Background ProcessesBackground Processes● Merb has a worker queue built-in

– run_later do # anything time intensive # not required for the responseend

● Push it outside request-to-response cycle

Page 67: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Built on RackBuilt on Rack● Possible to write a web app from anything with a call method

– require 'rack'app = lamdba {[ 200, {"Content-Type" => "text/plain"}, ["Hello World"]]}Rack::Handler::Mongrel .run(app, {:host => "127.0.0.1", :port => 4000})

● Merb works with any server with a Rack interface– mongrel, thin, ebb, passenger

Page 68: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Rack MiddlewareRack Middleware● Rack allows you to string together apps using Rack::Cascade● Merb has config/rack.rb

– based on request variables, target certain requests and handle them without invoking the full Merb stack

● serve RSS feeds● call an API● run a full out micro Rack app● use it just to modify the requests

Page 69: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

ExtlibExtlib● ActiveSupport is a kitchen sink

– with no immediate remedy– changes Ruby's very idioms

● Extlib isn't.– Just what you need

● Class#class_inheritable_*, cattr_*● Object#meta_class, try_dup, in?● String#snake_case, camel_case● blank?

Page 70: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Matz's OpinionMatz's Opinion● Rails makes drastic changes

to the Ruby language itself● I'm not a web-guy, but Merb

gives users more freedom in a Ruby-ish way of programming

● “Merb has a bright future for the people not satisfied by the fixed ways in Rails”

Page 71: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

DataMapperDataMapper

Page 72: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

DataMapperDataMapperdestroys ActiveRecorddestroys ActiveRecord

Page 73: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Auto-migrationsAuto-migrations● What you always needed but never knew● Get developers up and running quickly● Classic migration still around, but meant for production

deployments

Page 74: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Identity MapsIdentity Maps● This is false in ActiveRecord:

– @parent = Tree.find(:first, :conditions => ['name = ?', 'bob'])@parent.children.each do |child| puts @parent.object_id == child.parent.object_idend

● In DM, row-objects are equal to themselves

Page 75: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Lazy Loading DataSetsLazy Loading DataSets● Particular fields are treated as if they were associations, and only

loaded when you need them● You can define these in your model● By default applies to text and text-based fields

Page 76: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Strategic Eager LoadingStrategic Eager Loading● Makes working with collections easy.● Only issues the queries you need, when you need them.● :includes not needed● “Performant by Default”● Die N+1. Die.

Page 77: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

DataMapperDataMappermakes working with makes working with

collections easycollections easy

Page 78: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Anything for Easy CollectionsAnything for Easy Collections

Page 79: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

alias_method_chainalias_method_chain● Rails loves it.

– Implementation of the decorator pattern

Page 80: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

alias_method_chainalias_method_chain● Rails loves it.

– Implementation of the decorator pattern– Results in alias_method_chain hell.

● Makes code ridiculously opaque● With alias_method_chain as an accomplice, the standardly handled request

stack-trace shows at least 10 more lines to Mongrel than it does with Merb.

Page 81: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

alias_method_chainalias_method_chain● Rails loves it.

– Implementation of the decorator pattern– Results in alias_method_chain hell.

● Makes code ridiculously opaque● With alias_method_chain as an accomplice, the standardly handled request

stack-trace shows at least 10 more lines to Mongrel than it does with Merb.

● Merb hates it.– Prefers genuine refactoring, which is good for the API

Page 82: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb APIMerb API● Methods are documented as public, private, plugin

– public method interfaces will not change from version to version without timed deprecation

– private methods are not to be used by the application developer, providing the core team maximum flexibility for restructuring and increasing performance

– plugin methods aren't exactly as safe as public methods but are tagged so that plugin developers know it's acceptable to use them

Page 83: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Plugins are GemsPlugins are Gems

Page 84: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb PartsMerb Parts● Conceptually like Controllers for Partials● Widgets can be complex, so sometimes you need the logic layer● Thank you, once again, Abstract Controller

Page 85: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb SlicesMerb Slices● Like Rails Engines, just smarter and official part of the stack● Extract some code from your app and use it on others● Organized in the same MVC way● Some Possible Uses

– forums slice– groups slice– admin slice

Page 86: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb AuthMerb Auth● RESTful authentication● Cascading strategy pattern

– Login form, HTTP Auth, OpenID, custom strategies● Customize your logins

– or use the standard merb-auth password slice

Page 87: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

There's more...There's more...

Page 88: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

So much more...So much more...

Page 89: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 90: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 91: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Proven Production AppsProven Production Apps

Page 92: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Rails ExamplesRails Examples

Page 93: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 94: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb ExamplesMerb Examples

Page 95: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Facebook ApplicationFacebook Application

Page 96: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Javascript Framework

Page 97: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Javascript Framework( Merb Backend )

Page 98: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Apple already using MerbApple already using Merb

previously .mac

Page 99: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Search Engine

Page 100: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Search Engine( Merb Frontend )

Page 101: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Count them all as Ruby appsCount them all as Ruby apps

Page 102: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

MarketabilityMarketability

Page 103: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

RailsRailsRuby's Killer App

Page 104: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

RailsRailsRuby's Killer App

Forever?

Page 105: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Is marketing why?Is marketing why?

There's a lot of Rails promotional material and much of it is connected to Getting Real and 37signals, and that may be why clients

ask for it, but it's not why they want to use it.

Page 106: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 107: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 108: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

The Internet has made us all The Internet has made us all peer-consumers.peer-consumers.

Page 109: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 110: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Value isValue isall the promotionall the promotion

you need.you need.

Page 111: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Development TeamDevelopment Team

Page 112: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

EngineYard vs 37signalsEngineYard vs 37signals

Page 113: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

EngineYard vs 37signalsEngineYard vs 37signals● I am not going there.

Page 114: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

EngineYard vs 37signalsEngineYard vs 37signals● I am not going there.● DHH virtually made our

space. Respect.

Page 115: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

EngineYard vs 37signalsEngineYard vs 37signals● I am not going there.● DHH virtually made our

space. Respect.● Ezra, Yehuda, and gang – they

are making Ruby succeed.

Page 116: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb Advantage Anyway?Merb Advantage Anyway?

Page 117: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb Advantage Anyway?Merb Advantage Anyway?● Far more modular framework means that developers, including

core team developers, tend to work on features as gems– This significantly lowers the social barrier to entry and results in a

greater chance for both experimentation and innovation.

Page 118: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb Advantage Anyway?Merb Advantage Anyway?● Far more modular framework means that developers, including

core team developers, tend to work on features as gems– This significantly lowers the social barrier to entry and results in a

greater chance for both experimentation and innovation.● Core framework not in the opinion business

– Even though you may not find yourself using the standard Merb stack, the core development team will still be there for you by making sure that Merb plays as well as it can with your choice of tools.

Page 119: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

}}

Page 120: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Obviously bothObviously bothRails and MerbRails and Merb

are heavy-hittersare heavy-hitters

Page 121: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

There can be only one.There can be only one.

Page 122: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

The winner is...The winner is...

Page 123: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Any questions?Any questions?

Page 124: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Wait, who won?Wait, who won?Who's dead?Who's dead?

Page 125: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

It doesn't matter.It doesn't matter. That question was whack. That question was whack.

Page 126: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

True StoryTrue StoryI quit a job because we switched from Rails.

Page 127: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

But I left.But I left.

Granted it was from Rails to PHP, and because the consultancy was about cheap

labor, quick contracts, and no value.

Page 128: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

I love working in RailsI love working in Rails

Page 129: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

I love working in RailsI love working in Railsso don't ask me to kill it.so don't ask me to kill it.

Page 130: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb
Page 131: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb has fundamentalMerb has fundamentaladvantages for both advantages for both

developers and their clientsdevelopers and their clients

Page 132: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

IncludingIncluding● Superior performance that can translate to

saving on servers● Granulated modularity that increases the

potential reuse of code● Stack agnosticism that gives you the freedom to

use the right tools for the right job

Page 133: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Open-EndednessOpen-Endedness

Page 134: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

A way that can be taken rarely stays the way.A way that can be taken rarely stays the way.A name that can be given rarely stays the name.A name that can be given rarely stays the name.

Page 135: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

The applications we build The applications we build need a framework that can need a framework that can

grow alongside them.grow alongside them.

Page 136: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Merb is that framework.Merb is that framework.

Page 137: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Don't just believe me...Don't just believe me...

Page 138: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

class << your_mindclass << your_mind

Page 139: Battle Royale - pearsoncmg.comptgmedia.pearsoncmg.com/imprint_downloads/voices... · > whoami Foy Savas foysavas online (github, irc, twitter, etc) Ruby Application Developer Merb

Try it yourselfTry it yourselfgem install merb