Archive for the ‘Ruby on Rails and Software Development’ Category

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.

Installing the MySql gem on a fresh Mac OSX Leopard machine

Posted by Rahoul Baruah on September 24th, 2008 under Ruby on Rails and Software Development  •  No Comments

Rails 2.2 deprecates the inbuilt Rails MySql driver and you are recommended to use the native MySql gem instead.
Unfortunately, when I tried to install this on my fresh Leopard box I got:
Error installing mysql:
ERROR: Failed to build gem native extension.
Followed by a load of guff about options.
After a bit [...]

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

Mongrel, RAILS_ROOT and absolute/relative paths (or Mongrel bites me in the arse again)

Posted by Rahoul Baruah on April 28th, 2008 under Ruby on Rails and Software Development  •  No Comments

I’ve had this before so I should have learnt my lesson. But I didn’t.
I had a site, inherited from another developer, that was migrated to a new server.
The other developer sent me the images associated with the site and I dutifully copied them over. I took a look - lots of “missing [...]

The trouble with Ruby on Rails

Posted by Rahoul Baruah on January 6th, 2008 under Designing Great Software, Managing Successful Projects, Ruby on Rails and Software Development  •  No Comments

Normally I wouldn’t talk about Ruby on Rails on this blog. That geek talk is found on the tech blog instead.
But, despite being about Rails, this isn’t a tech post. It’s about a problem that you will face when trying to hire a Rails developer.
Rails has a number of advantages.

It is a framework [...]

Weird behaviour involving controllers, modules, namespaces and functional tests

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

Weird one here.
I was working on some code that had controllers within a namespace (Admin::ThingyController). The controller descended from an Admin::BaseController. And Admin::BaseController included a module (include GenericStuff), which in turn was defined within the Admin namespace.
So far, so good.
The code-base was actually somebody elses and the time came for me to add [...]