Noel Rappin Writes Here

I/O, I/O, It's Off To Work I Go

Posted on September 8, 2006


Welcome to our program, Things I Agree With Totally And Wish I Had Said First. Our hero tonight is Tim Ottinger with his hit, “Frameworks are for the Impatient". It seems Ottinger is puzzled by a library he’s trying to use..

Look, this framework is not the game Myst. I did not install this thing so that I could amuse myself for days by running around the file system trying to figure out what it is about…

In the Java world… [E]ven opening and reading a file is cause to go google the library one more time. Heaven forbid you have to manipulate dates or the like. These are small things, and should be very easy…. You shouldn’t have to crack open a half-dozen US$50.00 books.

One point of “obvious” is probably worth one hundred points of “clever”.

In the immortal words of Arnold Horshack, “Right you are, Mr. Kotter”. Hmm. That sounds better if you imagine it in a Horshack voice. Doesn’t look like much in print…

The Java io library is a particular nemesis of mine. I’ve been using it for what, just under a decade now, and the only way I was able to stop looking up the API every other week was to write a utility class that had an API that was actually useful (you know, obscure methods like copyFile, readlines, writeToFile…).

The io library may actually be the purest example of the Java school of OO design, marked by the principles like:

  1. Use an abstraction (streams) that looks interesting on paper, but that nobody ever uses. Ignore the abstraction (files) that is already established. When that doesn’t work, add a completely new abstraction (readers/writers) that’s completely non-interoperable with the first one.

  2. Make sure the user has to type a lot of words to get anything done.

  3. Make it just as easy to do obscure, complicated things as it is to do typical things, even if this means making it harder to do normal tasks. Doesn’t everybody want to randomly access binary files just as often as write some text? (Actually, there are obscure things in the API that are much easier than say, iterating over the lines in a text file).

Don’t even get me started on the nio package. Really, don’t. I couldn’t explain it on a bet.

Sigh. Java is too easy a target sometimes.



Comments

comments powered by Disqus

Copyright 2021 Noel Rappin