Archive

Posts Tagged ‘scripting’

Picking a scripting language

August 20th, 2010 joconner No comments

I’ve been working with Java for a dozen years now, actually more. I don’t really want to learn another language, or forget one. I’ve already forgotten perl too many times. But the problem is that I actually do need to learn another language. Java just doesn’t do everything for me.

For example, when I need to process a huge log file and write some data to another file, I don’t really want the overhead of writing in Java. What I want is to scribble something out and run it. I might keep the script around, but I might throw it away too. I need another tool. Perl once did this for me, once long ago. Then for whatever reason, I didn’t need it anymore. Now I need it again, but remembering how many times I’ve forgotten perl, I’m thinking maybe there’s a better language. Maybe there’s something that I can actually remember from week to week as my infrequent needs call upon it.

I’ve been thinking about a few language options:

  • Python 
  • Ruby
  • Bash
  • JavaScript

I’ve only read the introduction sections of books about Ruby and Python. Python just irks me with its dependence on space. I’m sure that’s a frequent complaint. For those who overcome that somewhat petty problem, the language seems to satisfy. But something about those procedures and method with __something__ surrounded with those underscore characters. Come on, what’s up with that? But the things that really do appeal to me about Python are the general ideas that explicitness is better that obscurity, that one common way is better than a dozen equally flexible ways, and that there is a best way to do something….well, those ideas are comfortable and appealing.

Ruby is fully object-oriented, and it actually does read nicely. I’m also interested in multiple spoken languages, character sets, etc., and I’m not sure whether it fully embraces Unicode as it’s character set. Maybe there are ways to make it work with UTF-8, but I haven’t quite advanced that far.

Bash? Uh no.

Can you believe that I actually considered Javascript briefly. When run under a vm with the Rhino implementation, your JavaScript code has full access to the JRE class libraries. Used this way, it really is only a way to script Java calls. For what I want, no “native” javascript functions exist to read the underlying file system or to create new files.  Without the boilerplate overhead of a full Java application, I suppose I could squeak out some extra productivity. In the end though, it really is just a way to work with Java code. JavaScript might be great within a browser, but on the file system? Hmmm, probably not.

So what are your ideas about a general purpose scripting language? Is perl still the best choice for system work, moving files around, parsing out some key values and writing them elsewhere? Did you move to Python and finally just accept the annoying white space issue? Or is Ruby a good tool for me. What do you know about these? Any suggestions?

Thanks!

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)
Categories: Tools Tags: ,