Ruby Vs. Python for Testing

There is an interesting discussion going on on the Agile-Testing Yahoo Group right now, about the differences between Python and Ruby.

It is oddly reminiscent of conversation I’ve had a dozen times recently – about the advantages of Ruby Vs. Perl. All of the old-school computer scientists are saying that there isn’t much difference, while the newbies who don’t know Python (or Perl) believe it’s the Cat’s Meow and the New New Thing.

I just put out a post with my two cents, which I will repeat here:


I was talking with a colleague about this and he pointed out that in Ruby you don’t need semi colons at the end of lines or parenthesis around function calls.

So, instead of this kind of thing (this example is in perl):

CookMeal(“Eggs”, “Ham”, “Bacon”);
ServitUp();

You can write this:

CookMeal Eggs, Ham, Bacon
ServitUp

—> To a computer scientist, this looks like BASIC – junk made up for 6th graders to learn programming, not real computer science. We cry out “Give me your strong indentation requirements and clear end of line parsers! Give me Python or Perl or C++!”

Yet – to a customer who is defining acceptance tests, the second example looks a lot more like the English language and less like a magical incantation.

And that, I honestly believe, is the major reason to that DSLs for customer acceptance testing are more popular in ruby than in python.

–heusser
Note – To get rid of the quotes, you’d have to define an enum type, which you ‘could’ do in any language …

3 comments on “Ruby Vs. Python for Testing

  1. Python, as elegant as it is, would probably look a lot more like this:

    Ingredients = [“Eggs”,”Ham”,”Bacon”]
    Cooked = reduce(Cook,Ingredients)
    ServeItUp(Cooked)

  2. I don’t think your example would actually work in Ruby. I don’t believe that method names can be capitalized. In Ruby, your example would probably be written like this:
    cook_meal :eggs, :ham, :bacon
    serve_it_up

Leave a Reply

Your email address will not be published. Required fields are marked *