Roda:

putting the fun back into ruby web development

Pavlo Zahozhenko

GitHub: @buru

Twitter: @pavlozahozhenko

  • 10 years in web development
  • participated in a few unsuccessful startups
  • now work at Natify Oy building ReceiptCamera.fi
  • weird hobby: teaching RoR programming course at Kyiv-Mohyla Academy

Typical Rails app after 3+ years in development

ActiveShuttle

acts_as_engine

Roda

Routing tree web toolkit

Jeremy Evans

initially a fork of Cuba

Routing Tree Basics

Code execution during the

routing process

Params matchers

Regexp matchers

array matchers

method matchers

Advantage: speed

Sinatra, Roda, and Rack "Hello, world!" apps to benchmark

Sinatra: ~2600 req/sec

Roda: ~7100 req/sec

Rack: ~8500 req/sec

273% vs Sinatra

83.5% vs Rack

Architecture: small core, extendable via plugins

Only 3 core classes:

Plugin loading mechanism:

(https://github.com/jeremyevans/roda/blob/master/lib/roda.rb#L161)

Example plugin structure:

Base functionality is itself loaded as a plugin, Roda::RodaPlugins::Base

So the plugin can override everything

And, surely, plugins can override methods of previously loaded plugins

Currently, Roda is shipped with ~70 plugins

Those are maintained by Jeremy Evans with the same level of quality as the core

Some examples:

Using it together with Sequel

Using it with Trailblazer

example usage of Trailblazer::Operation

Summary: advantages

Simplicity

  • small codebase (core + base plugin = 474 LOC)
  • very simple API, easy to get started
  • routing tree allows writing DRY code
  • no magic

Performance

Reliability

  • avoides constants, methods, and variables namespace pollution as much as possible
  • encourages immutability

Extensibility

  • small core + plugins architecture: everything can be overwritten

Summary: disadvantages

No routes introspection

No RAD tools found in Rails

Less gems, as many are tightly coupled with default framework

Much less community support

Some reinventing the wheel may be unaviodable

Trying it out

Mountable app

As a Rack middleware using :middleware pluginĀ 

Questions?

Made with Slides.com