Archive for the ‘Beautiful Code’ Category

The curious case of beauty in Ruby (or Rails vs Merb part 2)

Posted by Rahoul Baruah on December 27th, 2008 under Beautiful Code, Designing Great Software, General, Ruby on Rails and Software Development  •  7 Comments

I’m sure you’ve all heard the Rails 3 announcement. When I first found out my initial reaction was “fuck me“. But shortly after I was filled with a feeling of dread and general unease. And I didn’t know why ….
Firstly, a bit of history.
I first tried programming on a Commodore [...]

Acceptance Testing in Ruby, Rails, RSpec and Cucumber

Posted by Rahoul Baruah on November 21st, 2008 under Beautiful Code, Designing Great Software, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  No Comments

I’ve written up a new post at the Brightbox blog detailing how we are using RSpec and Cucumber to build acceptance tests for the next generation Brightbox systems.

Loading the MySQL drivers into GNU Smalltalk

Posted by Rahoul Baruah on November 14th, 2008 under Beautiful Code, Smalltalk  •  No Comments

It’s an unfortunate fact that many Open Source projects have documentation that is sadly lacking. A case in point is GNU Smalltalk.
Smalltalk is one of my favourite languages but a decent Smalltalk implementation that fits with your native window manager is hard to find. The point of GNU Smalltalk is that [...]

Showing the Git branch in your bash prompt

Posted by Rahoul Baruah on October 29th, 2008 under Beautiful Code, Writing Reliable, Bug-Free Code  •  No Comments

My first adventure in source control was many years ago. It was my first proper job and I was the sole developer in a tiny company. To keep the source code safe, it was all stored on a network share, and the file server was backed up at least once a day. [...]

The Specification is the Documentation Part Two

Posted by Rahoul Baruah on August 5th, 2008 under Beautiful Code, Designing Great Software, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  No Comments

Two (related) thoughts on “The Specification is the Documentation“.
One of the things that I like to do, when developing, is to start with a sketch (you know, with 95g/m2 paper and a 6B pencil) of how the UI will look. There are two reasons for this. Firstly, it helps communications with the client [...]

The Specification is the Documentation

Posted by Rahoul Baruah on August 1st, 2008 under Beautiful Code, Designing Great Software, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  1 Comment

In a former life I used to write “functional specifications”. These were long, dense, hard-to-read documents that detailed what an application (not yet written) was supposed to do. I would spend (literally) weeks typing these things up, the customer would read it, think they understand and I would quote them based upon the document. [...]

Setting up a mock object to test a :dependent => :destroy association in RSpec and Rails

Posted by Rahoul Baruah on July 10th, 2008 under Beautiful Code, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  No Comments

One of the great advantages of using mock objects to test and specify your objects is that you concentrate solely on the thing you are testing.  
If you weren’t using mocks to tests that a controller re-shows the “new” form if given an invalid object, you would do post :create, :model => { … } where [...]

To DRY or not DRY?

Posted by Rahoul Baruah on July 9th, 2008 under Beautiful Code, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  1 Comment

A very interesting article about how DRY you should be in your specs.  
http://lindsaar.net/2008/6/24/tip-24-being-clever-in-specs-is-for-dummies
Personally I agree with everything said.  Readability comes first, even at the expense of efficiency and DRY; “be nice to those who have to maintain the code”.  The really interesting thing though is the example is actually quite DRY - it’s more [...]

Ruby on Rails Basics

Posted by Rahoul Baruah on May 21st, 2008 under Beautiful Code, Designing Great Software, Managing Successful Projects, Ruby on Rails and Software Development, Writing Reliable, Bug-Free Code  •  No Comments

Sometimes, it’s worth stating the basics for all to see:

Follow the Model-View-Controller paradigm.  In particular, your views house your user-interface, your models handle the application and your controllers mediate between the two.  Controllers do not contain rules, conditionals dealing with business conditions, queries looking for objects related to the one in question.  All those things [...]

rake db:fixtures:load

Posted by Rahoul Baruah on November 9th, 2007 under Beautiful Code, Designing Great Software, Writing Reliable, Bug-Free Code  •  No Comments

rake db:fixtures:load is probably one of the most useful commands I have used recently.
You see, I was meeting some people about some potential work. They wanted to see an example - preferably related to payment systems. I had some code but unfortunately, the service that is part of had been switched [...]