Post on 18-May-2015
description
merbcontagion @ Ruby Tuesday, Taiwan
Ruby Web Framework
• The one and the only Rails• Actually, there are others...
• rmaze
• mack
• sinatra
• camping
merb
• Scalability
• Flexibility
• Awesome Features
and.......
Speed
Anything that slows merb down is a bug !
Size
• No Code is Better then No Code
• LOC
• Rails 24K~50K
• merb 10K~17K
Simplicity
• No Magic
• Magic is for your JOB security...
• Hacker’s framework ?
• makes you a hacker
• I Grok it !!
Call Stack
• Shorter Call Stack
• Rails 41~58 (more with plugins)
• merb 27~32
Adaptablility
• ORM - datamapper, active record, sequeal
• Javascript - jquery, prototype
• testing - runit, rspec
• template engine - erb, haml
Modularity
• Rails 6 gems
• merb 18 gems
• merb-core
• merb-more
• datamapper 9 gems
Merb API
• private Don’t touch them
• public
• plugin (overridable)
Plugin
• plugin is simply a gem
• dependency management !
• Hooks
• APIs
• no more alias_method_chain
Flexiable file layout
• fullstack merb-gen app
• core only merb-gen core
• simple merb-gen flat
• singel file merb-gen very_flat
Awesome Features
• Exception handling
• Run later
• sexy route
• Content Negotiation
• Slices
• Parts
Exception
• raise NotFound
• status = 404
• controller: exceptions
• action: not_found
• Not Log in
• status = 401
• controller: exceptions
• action: unauthenticated
Run Later
Sexy route
Content Negotiation
Slices
• mini application
• like Django’s app
• like Rails’s Engine
• reusability haven!
• ex. merb-auth, merb-blog, merb-cms
Parts
• a component
• component in rails1.0
• before filter + partial
Q&A