A Lagom Review of O’Reilly’s ‘Sinatra Up and Running’
Sinatra Up and Running is a new book published by O'Reilly and written by Alan Harris and Konstantin Hasse that covers the popular Sinatra web application DSL in a brisk 103 pages, acting as a tutorial to newcomers and a handy reference for old hands.
TLDR: It's a short, sweet, relatively cheap and very well written book about Sinatra. Recommended. Buy here.
An interesting quirk of Scandinavian society is the concept of Jante Law. It knocks down standing out and being individual, in favor of communal harmony. It's typically used in a negative context to lament restrictions and lack of risk taking within Nordic society (DHH touched on this briefly in a recent Mixergy interview) but the flip side of the Jante coin is lagom: the idea and ideal of having just the right amount of something.
Sinatra Up and Running is, second to K&R, the most lagom technical book I've read. At a mere 102 pages you may wonder whether it's worth buying - it is. Unlike most technical books - yes, including mine - it skips the waffle and provides a perfect level of detail going through from what Sinatra is, to how it works, and on to an example project that covers just 13 pages. Don't be fooled, though, this isn't one of those tiny format O'Reilly handbooks; it's a regular, full size book - just a thin one!
The book is split into three key sections:
- Sinatra's "fundamentals." We cover similar ground to the Sinatra README but I prefer the less generic examples in the book. How to build routes, use views, use sessions, caching, HTTP headers, and even Sinatra 1.3's new streaming functionality.
- Behind the curtain. The bulk of the book takes a peak under the kimono into areas where online documentation occasionally trips over or fails to mention. How is Sinatra implemented and what is its basic execution model? How do you create extensions for it? How does it integrate with Rack middleware? And how can you use Sinatra in a modular style?
- Blog engine project. A snappy run through a simple Git and Sinatra powered 'blogging' system.
As a core piece of printed documentation for a project, the book does a great job at sharing the basics, inspiring you to dig further and, of course, its short length puts Sinatra into context with the gargantuan Rails framework, where even a 400 page book would struggle to cover the essentials.
So, should you buy it?
Sinatra Up and Running is a good book and well written. I enjoyed it and picked up or was reminded of quite a few interesting bits and pieces. I'll probably refer to it from time to time. If your Sinatra experiences are rather on and off or you've not played with it for a while, it's a great, well-paced introduction.
If, however, you're already a Sinatra guru and/or working with Sinatra on a day by day basis and have all of the main patterns memorized, there's not a great deal you're going to get out of it. Buy it to be a completionist or to support the authors, but if you want a book demonstrating in depth how to integrate Sinatra with everything or how to big giant Web applications, this isn't for you.
Inexperienced Rubyists may also find the book's direct no-nonsense style intimidating. If you know what a code block is, you're good to go. This may seem like a bizarre observation to most Rubyists, but I've encountered many beginners who've wanted to "build a Web site" and immediately leapt into an advanced Rails book, only to be confused. If you're still new to Ruby, read The Well Grounded Rubyist or Beginning Ruby first.
And I'm going to stop here, because that would be lagom :-)
Where to buy
There are several options for buying the book. Check out O'Reilly (print, PDF, Mobi, and ePub), Amazon.com (print and Kindle), and Amazon.co.uk (print and Kindle) or your own favorite local bookstore.