CS 655: Programming Languages
Problem Set 3
Why Java Is Not My Favorite Programming Language.
Dana Wortman
Tuesday, March 6, 2001
Once upon a midnight dreary, while I coded, weak and weary,
Over many a quaint and curious volume of programming lore –
While in UNIX, clearly piping, suddenly there came a typing,
As of some one quickly typing, typing near my office door –
"’Tis some visitor," I stuttered, "typing near my office door –
Only this and nothing more."Ah, distinctly did my throat parch on that evening in early March;
As if through some triumphant arch came the JVM’s last chore.
Eagerly I wait for something; -- vainly I had tried to use Swing --
To my learned books I do cling – clinging to a hope for more –
For the chance to watch my program, run without a single error –
Nameless here for evermore.And the slow interpretation lines of bitecode one by one
Thrilled me – filled me with a hatred I had never felt before;
So that now, to still the beating of my heart, I stood repeating
"’Tis the JVM that’s working slowly working ever more –
Changing bytecode to machine code, slowly working ever more; --
This it is and nothing more."Presently my heart grew lighter; running code that was much tighter,
"Ha," said I, "exceptions working, catching all I do abhor;
But the fact is I don’t want that, and exceptions I do combat,
I neglect to take a look at, individual cases or,
Particular problems with the code – speed I’ll choose over and o’er; --
Exceptions caught and nothing more."Deep into that program peering, long I sat there wond’ring, fearing,
Wishing, dreaming dreams of using ‘goto’ like never before;
But the code it was unbroken, and the language gave no token,
And the only loops were written were the do, the while, the for
This I whispered, and an echo murmured back the words, "Use For"
Merely do, and while, and for.Then into my office turning, all my soul within me burning,
Wanting to use an assignment as an expression in my ‘for’.
"Surely," said I, "surely I can use assignments in my ‘for’ plan;
Let me see, then, what the book says, and this mystery explore –
Finding pages about looping looking for a word on ‘for’; --
Booleans allowed nothing more!"Open here I flung the next book, when for inheritance I looked,
I found only interfaces, ‘multiple’ and nothing more;
Not the least attempt was made here, to reuse code from year to year;
But, with a Java interface, you seem to accomplish more—
Howe’er each method must be unique written o’er and o’er and o’er –
Once per reuse, sometimes more.Then this language sat compiling my sad program without trying,
Claiming that one of my methods a class’s name it did not store,
Quickly as I searched all the text, else my mind e’er deeply perplexed,
Ghastly rule that each method must (or that method e’er be done for)
Be connected with a true class, extra classes what a chore!
Write a new class, what a chore!Much I marveled this ungainly language disregard so plainly,
Forcing methods’ dynamic binding – little efficiency bore;
For we wait till it is runtime till we see a match made onetime
Wasting time during processing hoping the user not to bore
While we wait and wait for Java to do what could be done before,
Instead we wait, for evermore.But then Java, brings in variables, treating us as old, old fools,
Making everything an object, forcing all to referenced store.
Nothing wastes more time than pointers – indirection o’er and o’er—
Till I scarcely know what’s real, "What did I origin’lly call for?"
Somewhere else within the program, conversions I have used before,
Objects, objects evermore.Wondering ‘bout the standard classes used so by the coding masses,
"Doubtless," said I, "what vectors need, objects alone they can explore
Primitives must use a wrapper avoiding a sure disaster,
Objects the primitives become, not ints or floats anymore
Complex objects they have become, primitives they are no more –
Simple items, Nevermore!"But then Java, still beguiling tricking my soul into smiling,
Thinking a float I can truncate, in reality ne’ermore,
Then, upon a compilation, allowing widening conversions,
From int to float has been allowed, float to int is nevermore,
Not allowing int to float has placed a damper I abhor,
Some conversions, Nevermore!Then I sat engaged in guessing, abstract data types for passing,
To a function that’s supporting, inheritance and something more?
This and more I sat divining, then I thought I started whining,
And I knew I started pining, for the long lost ‘void’ pointer.
Upcast to an object then you downcast o’er and o’er,
Process repeat, evermore.Then, methought, mem’ry grew denser, monitored by unseen sensor,
Referencing objects through pointers, then I realized with horror.
Pointer arithmetic was not allowed – and so to Java I then vowed,
"I cannot use a language that has no pointers at its core!
Speed and efficiency for me, what have you been waiting for?"
Vowed to Java, "Nevermore!""Java!" said I, "thing of evil! – deceiving coders even still! –
Claim to pass-by-value instead pass-by-reference evermore,
Primitives alone get copied, object references you do need –
Changes you really make indeed, changed the value evermore —
Is there – a way to avoid this? – tell me – tell me, I implore!"
Changes made for evermore."Java!" said I, "thing of evil! – arrays are objects even still! –
Arrays are a predefined class, a class themselves nothing more –
I wish I could use them easily, like in C, oh so feasibly,
Unfortunately, you will see, much overhead must be bore,
For the weight of using classes, is substantial as before."
Weight of classes, evermore."Be this word our word of parting, multi-dimmed arrays are starting,
To be more than what they are worth, worth their name and nothing more.
Overhead of array-arrays, despite its glory far out-weighs,
Any usefulness in making multi-dims for evermore.
Since they’re objects they can’t start to be efficient evermore.
Shall be lifted – nevermore!And then Java, one last feature, wasting moments, like a creature,
Living in the deepest sewer, suddenly appears before,
You try some intense mathematics, wasting time you know the clock ticks,
And the mem’ry fin’lly is free, you can go on as before,
Knowing Java’s complete control, cannot turn it off e’ermore,
Ran the garbage collector.
Bibliography:
Sebesta, Robert W. Concepts of Programming Languages.
Addison-Wesley. 4th Edition. 1999.
http://java.sun.com/
http://developer.java.sun.com
http://www-106.ibm.com/developerworks/library/j-king.html?dwzone=java
http://www.research.ibm.com/journal/sj/391/moreira.html
Poe, Edgar Allan. The Unabridged Edgar Allan Poe. Running Press. 1983.