Ladies and Gents, this weeks' featured tool is a cool little number that's really gotten under our skin here at the office.



Sinatra is a ruby based web development framework that is targeted for very small projects.  It is not your typical web framework, as the the entire code base (with built in documentation sans tests) weighs in at 1162 lines of code.  It is substantially different from other frameworks like CakePHP or Ruby on Rails because the applications typically reside in a single file.

In fact, most applications built using Sinatra are only a handful of lines long.  Take the following example for the classic "Hello World" app:



When run, the above code will fire up a small web server that will greet you with "Hello World" when "/" is accessed.

Many of you out there may be asking yourself, "What is the use of that?" Well, I'll lift a quote from old blue eyes himself:
"I'm not one of those complicated, mixed-up cats. I'm not looking for the secret to life.... I just go on from day to day, taking what comes." -Frank Sinatra
Mr. Sinatra was obviously a minimalist.  A simple man that liked to sing songs.... Sing songs and hang out with the President of the United States, Marilyn Monroe, and the mob.

Anyway, most frameworks are overkill for simple projects. Larger frameworks are great for sites that need to do a lot of heaving lifting, but more often than not they're simply too big for little tasks.  Would you use a jackhammer to hang a picture? Big solutions don't make sense for little problems.

Need a quick web interface to a database?  Sinatra can handle it. Need to build a simple Facebook app? Sinatra knows that diddy too. Have an idea for an application that could make killer linkbait? Sinatra could sit in. Any small task that you need to accomplish over the web, Sinatra can help you accomplish, with minimal effort.

That being said, I will give you guys a head up and say that Sinatra is young and won't take care of everything for you. We used Sinatra to build an application we're using behind the scenes here at the Mozplex. While it offered the benefit of "immediate results," as time went on we found ourselves adding more and more features to it.  Our simple little app started becoming more and more complex. When we tried introducing tests into the application to keep it maintainable, the results were not so immediate. That being said, your mileage may vary with Sinatra.  However, for those small tasks where you need to get something done immediately, it can be a life saver.

If you're interested in some apps that are powered or used by Sinatra, here are some links to check out:

https://github.com/deadprogrammer/frankie/tree/master
https://atonie.org/2008/02/git-wiki
https://carlosgabaldon.com/calabro/blog/post/2008/04/14/Singing_with_Sinatra

If you're interested in another framework that is similar in nature to Sinatra, I highly recommend Ramaze.  It is very polished, very thoroughly documented, and has an extremely friendly community behind it.

That's it for this week. I apologize for the lengthiness of this article, but "I Just Couldn't Say Goodbye."

EDIT:
I still can't say goodbye.  I forgot to add two more links that may help demonstrate how quickly you can get up and running with Sinatra.

Tasty little screencast:
https://www.xnot.org/sinatra/movies/intro_1.mov

Useful beginners guide:
https://www.xnot.org/sinatra/beginning.html