Archive for the ‘Writing Reliable, Bug-Free Code’ Category

Writing tests for your controllers improves the design of your models

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

I’ve recently been updating some old code - partly written by someone else, partly written by myself. At the time, I thought I had written this code really well; looking back on it now, it looks awful. Fair enough, I’ve learnt a lot - I want to look back on old code and [...]

Coping with the VAT Change

Posted by Rahoul Baruah on November 25th, 2008 under Designing Great Software, General, Writing Reliable, Bug-Free Code  •  1 Comment

There seems to be a lot of wailing and gnashing of teeth about the upcoming VAT change. Especially as it is only a 13 month change and the rate will revert to 17.5% in 2010.
However, it ought to be really simple (although I realise that this may be a bit late for [...]

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.

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. [...]

Telling Stories with RSpec

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

Last night I gave a talk at Geekup about RSpec and RSpec User Stories.  
 
Telling Stories With RSpec
View SlideShare presentation or Upload your own. (tags: ruby rails)

 
Thanks to Ashley Moran for talking it through with me.
UPDATED to use Slideshare to display the slides.

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 [...]