1. Computing

What is Padrino?

By

Padrino is a web application framework built on Sinatra. This might sound a bit odd, a framework built on a framework, but one of Sinatra's core principals is to stay small and elegant. While this is good (Sinatra is only about 1,500 lines of code), it does leave a little to be desired. Where Sinatra is a thin layer of mayonnaise on bread, Padrino is a second layer of mustard. It's not all that much either, but it brings a lot of flavor to the party.

Metaphors aside, Padrino makes Sinatra a lot more Rails-like in that it delivers a complete and usable web application framework, rather than a handy little tool to hack up web apps. For example, it provides interfaces and generators for ORM libraries (like ActiveRecord and Datamapper), renderers like Haml and ERB, testing frameworks, stylesheets, etc. In addition to this, it provides an admin interface for all of your data and an account and authentication system so you don't have to build any of that yourself. In short, Padrino is a web app in a can, and a much smaller can than Rails (which might as well be a 55 gallon drum).

Agnostic

One of the core principals of Padrino is library agnosticism. Where Rails (at least Rails 2) only really allows you to use ActiveRecord for your ORM, Padrino allows you to use many. Every ORM that I could think of is supported, so you can use anything you want to.

This principal extends to more than just the ORM, allowing you to use many different renderers for HTML or CSS (Haml and Sass being the main ones, but Erb and Less are supported) as well as testing frameworks, client-side scripting and mocks. Padrino let's you use it all, so you're not stuck working around whichever one it provides.

Administration and Authentication

Padrino comes with an authentication database out of the box. Be honest, how many web applications need authentication? The answer is usually all of them. How about an administration interface? Again, the answer is usually "all of them." Padrino supplies these things out of the box, so you can just take it and run with them.

While the admin and auth solutions Padrino provides aren't perfect, they are just Padrino apps themselves, generated right into your application directory. If you need them to do something a little different, you can simply change them.

Sub-Applications

Another feature you may really like is the ability to map sub-applications within your main application. The admin interface mentioned above uses this mechanism, but you can easily create your own sub-applications. Sub-applications live in their own directory tree right next to your main application and are "mounted" using a simple method call.

There are a lot of possibilities for sub-applications, the most obvious being reusable components. Simply mount the sub-application in your main application and you're done.

Much More

Padrino is much, much more than what was mentioned. The amount of work done here is amazing and the fact that many Rubyists haven't heard of Padrino is a shame. For even more information, see the Padrino website, and in particular the blog screencast (what Ruby framework would be complete without a blog screencast?).

  1. About.com
  2. Computing
  3. Ruby
  4. Tutorials
  5. Padrino
  6. What is Padrino?

©2014 About.com. All rights reserved.