Recent News

MicroApps (or little ditties) with Sinatra

Me and one of the other horses left the stables recently and went to RailsConf. Of all the sessions I attended, my favorite one was by far Erik Kastner’s talk entitled MicroApps for Fun and Profit.

Erik Kastner explained that MicroApps are small apps that you can write the bulk of the code in a day… or get completely done in one sitting (one day).

They can be simply HTML or HTML/CSS/JavaScript… they can be written in Camping, they can be API mashups, you could use Yahoo! Pipes, it could be just text on a page. You could use Ruby on Rails, you can use a blog engine… it doesn’t really matter, it just has to be done in one sitting.

The app he demoed (called Jeff4Good ) is a one-page web form that takes “donations” of stuff or money to help his friend Jeff who needed money for a hospital trip that cost him a bunch of money.

The Jeff4Good app uses the relatively new ruby microframework, Sinatra. He wrote it within one day. Personally, I have ideas for web apps all the time – it’s rare that I have time to actually get something out there, but the MicroApp “philosopy” that Erik Kastner proposes (along with things like the Sinatra framework) makes it seem so much more possible to get stuff out there. I love the idea of getting something completely done in one sitting – I’ve got waaaay too many ideas that haven’t been implemented right now.

Erik pointed out that the title of the talk should be “MicroApps for fun and Micro Profit” because most of the MicroApps that he has written were not profitable – or if they were, the profit wasn’t much.

The profit that you do gain, however, is that you get to learn something new and you build your portfolio. You can play around with ActiveRecord or DataMapper in new ways. You can start hacking on API’s that you haven’t played with before. You also get to build your portfolio of successful web apps. That can lead to promotions or job offers.

Erik also pointed out that he’s been able to work with some high profile developers and designers because he didn’t need a big commitment from them… you might be able to get a great designer to help out on a fun little project and make your MicroApp look super sweet.

Some examples of MicroApps:

metaatem.com/words (Spell your name in pictures from Flickr)

Twistori (twitter mashup)

Foamee (twitter mashup – tracks who you owe beer or coffee to)

CrocSpotting (a phoblog (photo blog) that uses Yahoo! Pipes & a Flickr feed of Crocs (you know those shoe things))

Learn more about the Sinatra Microframework at sinatrarb.com and gittr.com

Write your first “hello world” Sinatra app in less than 60 seconds:


$sudo gem install sinatra
Then, start writing your code in a *.rb file (e.g. frank.rb).
1
2
3
4
5
6
require 'rubygems'
require 'sinatra'

get '/' do
"OMG, like, hey world!"
end

Save your 5 lines of code and then run the app:


$ruby frank.rb

Then, it should say:


frank takes the stage on port 4567

Go to localhost:4567 in your browser.

“OMG, like, hey world!”

See – fun… and easy!

Comments

  • Chris Schneider on 17 Jun 21:17

    Thank you for the link to my blog (gittr.com)! I have been really enjoying the niche that Sinatra, and other micro-frameworks fill (Camping and Ramaze off the top of my head). They're great at just getting something out there with far less of the groundwork that larger frameworks like Merb, and Rails require. For anybody curious about Sinatra, it is more than worth it to use the git version. It's very stable, and is actually a bit overdue for a gem release. Lots of new features, and most of the documentation I write on my blog is based on the development version on github. Check it out at http://github.com/bmizerany/sinatra/tree/master
  • Luiz on 08 Aug 01:43

    How can I use Session in Sinatra?


Comments are closed

cementhorses.com

Categories

Cement Horses Pics

Archives