07/03/2012

Padrino, When You Find You Need “A Little More”

Many developers love the simplicity and beauty of Sinatra, but end up longing for some of the functionality it lacks. If that happens to be you, why not try open source Padrino?

Padrino was created in 2010 to be a complete toolbox rather than just a little tool to create web applications. The framework was originally created by Nathan Esquenazi, Davide D'Agostino and Arthur Chiu based on the prior sinatra_more gem. The main objective behind developing this framework was to make it robust enough for complex applications while maintain the characteristics of Sinatra.

Here’s an overview of the basic features and capabilities:

Agnostic
The beauty of this framework is that it allows you to use as many Object-relational mapping as you want. Library agnosticism is the core principal of Padrino. It also supports many different testing frameworks, and renderers for HTML and CSS. It gives you a wide range of options so that you don’t feel restricted.

Generators
This feature of Padrino provides support for generating or creating new Padrino applications. It auto-generates a “Gem file” that lists all the dependencies and provides guidance to help new developers. This can make development on this platform much easier.

Routing
Instead of using complex routing setups, Padrino uses HTTP verbs for routing declarations. It is basically a more explicit, readable, and easy way to write code. It supports named parameters, namespaced route aliases, nested routes, and responds to formats. These route aliases help in writing URLS in your applications easier than in Rails.

Localization
An important feature of Padrino is localization support. Currently, these languages are being supported among some others:

  • English
  • German
  • Italian
  • French
  • Russian
  • Czech
  • Danish
  • Brazilian
  • Spanish

Tag Helpers
These are the basic building blocks that are used to create html ‘tags’ in a View template. This feature is made up of three functions:

  • tag: used to create any random html tag
  • content_tag: used to create any random tag with specific content.
  • input_tag: used to create tags to accept some input from the user.

Admin
Padrino supports user authentication. Now you can create a new admin interface by simply writing some of your own changes.

Logging
Padrino also provides good logging capabilities. The logging information is stored in an environment specific log file and is capable of interacting with any ORM or library.

Reloading
Padrino has the ability to reload server code and the changing application files without restarting the server. This speeds up development.

Mountable
Padrino applications have the capability to automatically mount into other Padrino projects. In other words a single Padrino directory can easily mount multiple applications instead of constructing an application separately. For example, authentication and administration applications can be reused. This makes things more flexible and organized.

So if you like the elegance of Sinatra, but want more functionality, Padrino just might be the right choice for you. Check it out at padrinorb.com