We had adjourned to the kitchen, it was done in some old mock style from somewhen. Not Victorian, but nearly, pretty ugly. I whisked the green tea and followed the ancient ritual. The master had never subscribed to the nonsense about coders being caffene-fuelled chocolate junkies. Brain-dead, tired, and fat, not to mention incipiently diabetic. The master could be hard at times, but fair. The hot tea steamed up my glasses, the spittle-encrusted coat was being dried on a chair next to the Aga. We sat quietly for a few moments’ contemplation. I noticed that his collection of pipes still adorned the mantlepiece. I could see his need for the demon weed pulling at him, but he firmly turned his back on it.

So, master, you say that we at least have two types now, ints and strings? Why is this bad?

It isn’t bad, my young friend, just silly. Who needs typed variables any more? A variable should be able to be whatever it pleases, and have a bath twice on Sundays if you wish it. To pass things around in Java you have to create utilities that use Object types and then remember what type they are, or you have to hide some array-like construct (say a Vector) in an accessor class that returns the correct type – Java 5 has some syntatic sugar for this, to be sure, but it always generates a compiler warning message, which really drives me crazy. Java 5 isn’t mainstream yet, all of your legacy code is still riddled with anonymous objects flying around – it’s a mess. It’s said to be flexible, but it’s just a lazy anarchy inherited from C++.

He sighed, and you have to wrap the base types in wrapper classes – again Java 5 has removed some of this by doing it automatically. But why has it taken ten years to take this implementation pain away? Why has it taken ten years to do some of this? Why isn’t there syntax for associative arrays? Because the vision of the language designers was clouded by ‘C’ and C++. C# is just a continuation of this as well, as far as I can make out. I don’t have time to learn the Dark Side as well as the Grey.

And that brings us to the vexed question of the absence of lambda functions and variables that point to functions – a piece of brilliance that goes all the way back to Lisp, even ‘C’ could do pointers to functions, I used it all the time, but of course it scared people who wanted to use ‘C’ to write COBOL.

I was puzzled. I thought you didn’t like ‘C’, master?

Did I say I didn’t? I just said you had to be very disciplined and test things thoroughly. This palace you sit in was built by ‘C’ and Unix, all I said was you shouldn’t take the crazed rantings about simple and confuse it with complete.

Master, surely anonymous classes are the lambda functions you seek?

He paused for a moment and cracked some walnuts with his new biceps, while he considered this. Then he smiled and offered me some. I declined for my biceps have not been subject to his punishing training regime.

Grasshopper, you are beginning to learn. That is the first original thought I’ve heard from you; keep it up. So we could define some aribitrary interface that allows us to define an aribtrary, anonymous object that allows us to create our anonymous function depending upon, say, an if statement?

I nodded. He sipped his tea and reached meaningfully for the sugar bowl.

Ah, master, again, no sugar. You can do it but it involves creating objects and interfaces that type those objects.

He smiled again, not touching the bowl after all. Unecessary complexity, functions can’t just stand out there in the naked wilderness and do their jobs, you are forced to go class class with extra fries and a milk shake to write 5 times more lines of code than you would in Python, PHP, or Lisp. Like everything in Java, you can do it but it hurts, it takes time and its a pig to maintain because the way you are using the construct is too outre for the masses that may have to look after your code when you have finished.

… you just try getting a comment saying this is a lambda function construct through a code review. He started giggling to himself and started on another chorus of ints and strings.

Let us pause here, for a little while, Grasshopper, and we will talk about Java and the Web. Why is it so slow to develop in and what can be done about it.

I sat and watched the steam rise from the tea cups, content to be silent for a while. I wondered, how do you use ‘C’ to write COBOL?

Facebooktwittergoogle_plusredditmail