Skip to main content

A Fool's Errand

Posted by evanx on May 19, 2006 at 2:44 AM PDT

A reader commented to my blog "Java is all you'll ever need" that "anyone thinking he needs only a single tool to do any job is a fool." That would be me. So lemme introduce you to this fool's errand...

penknife.jpg
Of course we need more than one tool. But it depends what you define as a "tool." Every library is arguably a different tool. So then a programming language is a tool to write tools (libraries) to help with some specific tasks. If you prefer one programming language (eg. Java) and development environment (eg. Netbeans) over all others (eg. bash, python, perl, vi) then that is your sharpest tool for writing tools.

I have my favourite Java Leatherman with me, and so I gonna leave my Python Army Knife at home.

Bash is written in C. Clearly it could be rewritten in Java. But let's not do that, let's write a better bash. And rather than a scripting language, let's just write a framework and library.

Even if not as concise as a purpose-built scripting language, our approach will have the advantage of being able to leverage tools like Netbeans and Eclipse right off the bat to write our "scripts." And that is no small thing in my book.

My main argument against bash, python, perl, C et al, is very simple and personal. Just that they are not my favourite language, programmable using my favourite IDE. That is, they are not my personal favourite programming tool.

When I was at school in the 1980s, my first big pet project was writing a 4GL in Basic. A scripting language of sorts. I spent years on that thing. I was emulating my father because he wrote 4GL language tools.

When i discovered C, everything changed. Now rather than write a new scripting language, you would just write a new framework and library, because C let you do that. And Java has made that truer than it ever was with C.

nail-hammer.jpg
It's true that shell scripts (and scripting languages in general) are gonna be much more concise right off the bat for scripting system tasks. Bash is specially designed for that purpose.

But Java (like any language) let's us write a library to support writing tasks, so that we can approach the brevity of shell scripts, without the downsides of shell programming. And with a big upside if Java/Netbeans is your favourite hammer and so you want everything to start looking like a nail.

So watch out for my blog in the next few days titled "Bin Bash Java (Chapter 1)." As you can surmise, it's the first in a series. It's the beginning of a journey, to create a library so that I can say goodbye to my bash scripts and do some serious "scripting" on Windows too. I hope to meet you along the way!

Update. This blog continues over at "Bin Bash Java (Chapter 1)". Also Check out NailGun which aims to obviate the start time of the JVM, eg. for Java command-line tasks. They say, "Java has an extensive and robust core API and huge number of available open source libraries. It's a great big hammer, making almost any programming project look like a nail."

Related Topics >>