Rails vs. Sinatra • “Rails is a framework focused on writing model driven web applications” • “Sinatra is a library for dealing with HTTP from the server side” -Konstantin Haase, maintainer of Sinatra
Sinatra as a Tool for Beginners • Introduction to Rack/Middleware • Opens up the world of Model-View-Controller (MVC) • Write out RESTful routes • Great error messages • Beginning Ruby developers can begin to interact with their code on a new level
Structural Differences • Sinatra is not “pre” rails, but rather a different kind of thing • Model-driven applications (Rails) • Controller-driven applications (Sinatra) • Sinatra deals with server-side HTTP requests
Mix + Match • Padrino (Ruby framework built on Sinatra) • Yehuda Katz built Sinatra in Rails (testing whether Rails is a good toolkit for building new frameworks) • Complementary frameworks: using Sinatra in Rails as tenant structures to modularize your app
Convention vs Configuration “The biggest disadvantage with Sinatra not solving the issue for you is, well, Sinatra not solving the issue for you. You actually have to deal with that issue. You might end up wasting too much time dealing with it.” -Konstantin Haase “The default Rails app provides a lot that I need which requires extra setup in Sinatra. This can lead to faster development in Rails.” -Ryan Bates, Railscasts
Framework vs Library • “Inversion of Control is a key part of what makes a framework different to a library.” • “A library is essentially a set of functions that you can call” • “A framework embodies some abstract design, with more behavior built in. In order to use it you need to insert your behavior into various places in the framework either by subclassing or by plugging in your own classes” -Martin Fowler
Takeaways • Important to recognize the ways you are conceptualizing a new concept and what drives that • When in doubt, return to objects • Using the right tool for the right problem • Tech talks for beginners = a great way to better understand what you’re confused about + open source the learning process