Monday, October 31, 2005

Not a fan of scripting languages

Let me first be clear, that I am not a fan of scripting
languages.  They certainly have their place, but I would never
write an entire application with one.  I wouldn't even write anything that amounts to more than a macro.  I need compile-time errors.  I hate making typos and never finding out about them until runtime, or never.  [6/7/06 update: I feel better about them lately, and might write much more than a macro.]

That being said, among scripting languages I think Ruby rocks! 
The object-oriented nature of it permeates every element.  Even a
fixed number has methods.  Every object is extensible at runtime
as well, and mixins are brilliant.  Not everything about Ruby is
great (it is a scripting language, after all).  But it's cool
enough that I use it here and there.  So I'll blog about the
lessons I learn and the stuff I create.

Lately I've been  working in an embedded Linux lab, writing
software to drive a car with gizmos on it to collect colored balls and
drop them into a goal.  The lab material suggests C.  I
started with C#
, and it worked great.  The problem is that even
though my code was more readable and object-oriented, it turned 20 line
C program into 60 lines.  Sure, most of those lines were reusable
libraries, but I thought it would be hard to sell my teammates on the
larger codebase. 

Then I tried it in Ruby.  I found that the libraries just looked
smaller.  No compilation was necessary (on an embedded system,
that's convenient for debugging when no compiler is on board). 
The biggest boon was the interactive interpreter so that code could be
run on the fly.  So Ruby is how I'll finish this lab.  Cool.

No comments:

Post a Comment