View this site in English Ver este site em português

Archive September, 2011

Book Review: The Mythical Man-Month (MM-M)

24 September, 22:05, by zehzinho Tags: ,

During the last month I’ve been reading the quoted-often-but-followed-rarely Mythical Man-Month. What a nice book!

Fred Brooks starts the book talking about the programming art. Why is it fun, after all? He points many reasons and, among them, the joy of always learning. I totally agree with him, and if you don’t like it, please stop working as a programmer.

The book is just great. Despite my own fault of reading it only now, when I’m 26 and after graduating I got shocked by the unpopularity of the book here in Brazil. At my workplace, with 70 programmers I’m almost sure that nobody has read it (including the bosses), insane!

Why is the book special? Man, almost all those things you hear agilists talk about were first written in the MM-M! For example, about documentation:

“As a principal objective, we must attempt to minimize the burden of documentation, the burden neither we nor our predecessors have been able to bear successfully. An approach. The first notion is to use the parts of the program that have to be there anyway…”

It’s impressive how this guy was able to figure out all those problems in the software production field and, still better, propose solutions! It’s impressive how he was able to write a book so clear in 1975, when the field was in its early infancy (I believe it’s still in the infancy).

Obviously, there are one or two chapters which are no longer relevant and some predictions which did not come true, but the book as a whole is invaluable. I’ve read the anniversary edition, and if you have access to it, I would recommend that you first read the last chapter, in which Brooks gives a retrospective of all the “mistakes” made in the first edition.

Finally, out of the almost 300 pages, I’ve got 95 notes and marks on my kindle. An average of 1 note for each 3 pages is quite impressive for a book from 1975, isn’t it? So, if you still wonder if the book is worth your time, have no doubts from now on.

Less, The Path to Better Design by Sandi Metz at GoRuCo 2001

18 September, 22:16, by zehzinho Tags: , , ,

Yesterday I watched @sandimetz talk about OO design. The presentation is simple and rich (hard to achieve, right?) at the same time. I liked her criteria for design judgement. Is it TRUE?

Transparent
Reasonable
Usable
Exemplary

I had also adopted the last criteria when reviewing my own design. Having an exemplary design is exactly what lets you sleep at night, right?

The presentation:

GoRuCo 2011 – Sandi Metz – Less – The Path to Better Design from Gotham Ruby Conference on Vimeo.

The slides are available at heroku:

http://less-goruco.heroku.com

More videos from the Gotham Ruby Conference (#goruco) are also available at vimeo:

http://vimeo.com/goruco

You should take a look.

How to restart a rails or sinatra app on dreamhost

18 September, 22:14, by zehzinho Tags:

Hi guys, if you followed my last post about running sinatra on dreamhost, you may have gotten frustrated when you tried to update your code. Dreamhost just didn’t want to refresh it, right?

Well, in the past it seems that the process was quite exoteric. I’ve read you had to create some tmp/shutdown.txt file or something like that.

Well, looking at the dreamhost wiki about rails deployment, I found out that the process got simpler. All you have to do is:

$ killall -USR1 ruby1.8

If it doesn’t work (perhaps they’ve updated their ruby version), you should take a look at the running processes:

$ ps -e

ok? Enjoy

Deploying (the latest) Sinatra apps on Dreamhost

18 September, 22:13, by zehzinho Tags: ,

Today I decided that would run my Sinatra app on Dreamhost. Until today I had only run the app on localhost, via shotgun. After trying to deploy it on heroku, without success, I remembered I had a shared account at dreamhost and then, why not?

Ok, after some failures (no single tutorial worked) I finally managed to make it run. Assuming you already have a sinatra app working and configured it using bundler, here are the steps that worked for me:

$ mkdir ~/.gems $ mkdir ~/bin $ mkdir ~/lib
$ mkdir ~/src
$ cd ~/src
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.7.tg
$ tar zxvf rubygems-1.8.7.tgz
$ cd rubygems-1.8.7 $ ruby setup.rb --prefix=$HOME

Then, added to my ~/.bash_profile:

export GEM_HOME="$HOME/.gem"
export GEM_PATH="$GEM_HOME"
export RUBYLIB="$HOME/lib:$RUBYLIB"
export PATH="$HOME/bin:$HOME/.gem/bin:$HOME/.gem/ruby/1.8/bin:
$HOME/usr/local/bin:$HOME/usr/bin:$PATH"

and then, back again to bash:

$ source ~/.bash_profile
$ gem install bundler
$ cd path_to_your_app
 Important! Your rack version must be “1.2.1″, so in your Gemfile you should have:
gem "rack", '1.2.1'

Now you can build you gems:

$ bundle install

Finally, your config.ru should also contain the following lines:

Gem.clear_paths
ENV['GEM_HOME'] = '/home/your_user/.gem'
ENV['GEM_PATH'] = '/home/your_user/.gem:/usr/lib/ruby/gems/1.8'
require 'rubygems'
require 'bundler'
Bundler.require
FileUtils.mkdir_p 'log' unless File.exists?('log')
log = File.new("log/sinatra.log", "a")
$stdout.reopen(log)
$stderr.reopen(log) disable :run, :reload
set :environment, :production
set :views, File.dirname(__FILE__) + '/views'
require 'app'
run Sinatra::Application
 And that’s it! I’m running the latest version of Sinatra (which today is 1.2.6) without problems \o/

If you run into problems, the two posts which helped me most were the following two:

Using Bundler for Sinatra Applications On A Shared Host

and

Sinatra on Dreamhost