Schedule and Events



March 26-29, 2012, Software Test Professionals Conference, New Orleans
July, 14-15, 2012 - Test Coach Camp, San Jose, California
July, 16-18, 2012 - Conference for the Association for Software Testing (CAST 2012), San Jose, California
August 2012+ - At Liberty; available. Contact me by email: Matt.Heusser@gmail.com

Monday, December 10, 2007

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:

Anonymous said...

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

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

Bret Pettichord said...

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

Anonymous said...

Blog messages are really good, keep up the good work. Folk, find information on software QA and testing in http://softwaretesting-faq.blogspot.com/