Sinatra and Bourbon - Web Development My Way

Originally published at: http://www.sitepoint.com/sinatra-bourbon-web-development-way/

When you think about Sinatra and Bourbon, web development might not be the first thing that comes to mind. (It’s certainly not the first thing Google suggests, and I’m not the first one to notice that.) But when I’m starting a web application project, Sinatra and Bourbon go together like, well, you get the idea.

Early Decisions

Picking a framework for back-end web development is one of the most critical early decisions, whether you approach it from the back end or the front end. For many Ruby developers, the obvious choice for years has been Rails, with its huge community and comprehensive “convention over configuration” convenience. But recently the framework that has been inspiring the most versatile imitators, such as Express for Nodeand Laravel for PHP, has been Sinatra.

Similarly, on the front end, there have been several popular frameworks such as Zurb Foundation or Twitter Bootstrap that offer to handle all your front-end concerns as long as you follow their conventions. But for people who want the most flexible and the lightest-weight solution, there are few solutions that are as unobtrusive while being as comprehensive as Thoughtbot’s suite: Bourbon, Neat, Bitters, and Refills.

The stack I like to start with when kicking off a new project these days is a combination of these two powerful and low-key packages. The only tricky part is getting them to play well together. But once you have that problem solved, there’s no end to where you can go with this combination.

The Sinatra Advantage

Sinatra is a leaner, more lightweight way to structure a web application than Rails. Among the advantages of Sinatra are its simplicity and its unopinionated approach to development. If you prefer to structure your entire application as a single page of Ruby code, you’re more than welcome to do that. And it’s that apparent simplicity that led some people to ignore Sinatra in favor of its more comprehensive cousin, Rails. But when you want to grow into more complex code organization, Sinatra will be right there with you.

Frameworks in general are designed to make it quick and painless to get a project out of your head and out into the world. But when you start to get into the meat of publishing and maintaining your web application, you may start to bump your nose against the limitations of the early choices you made. It’s not usually a good idea to try to predict too far in advance where your unique product is going to need to go as it finds its market.

With a highly opinionated framework such as Rails, you may find your work cut out for you if you decide you want to make changes that aren’t natively supported by the way Rails structures its code. Although Rails has gotten better about flexibility over the years, once you buy into a comprehensive framework that tries to do everything for you, any deviation you make to suit your particular needs risks complicating the convenience that drew you to the framework in the first place.

On the other hand, Sinatra’s simplicity encourages you to develop your application’s api the way you want to, incorporating the gems and other Ruby tools that suit your purposes. Because Sinatra doesn’t try to perform a lot of magic behind the scenes, an application you develop with Sinatra is more transparent and more versatile in the hands of a developer with her own opinions.

The Bourbon Advantage

Continue reading this article on SitePoint
1 Like

I love working with SInatra, and Bourbon, thanks for the write up

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.