Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: A peek at the other side or, Poof and He's Gone!

by grinder (Bishop)
on Oct 23, 2001 at 16:25 UTC ( [id://120759]=note: print w/replies, xml ) Need Help??


in reply to A peek at the other side or, Poof and He's Gone!

Disclaimer: I have written one Java program in my career, (although I have read quite a few).

Take this personal mistake that I made in a critical data path as an example:
for (int i<0; i< array.size(); i++) { String result = "PR-" + array[i] + "-RD"; file.write(result); }

I can safely say I wouldn't have made the i < array.size() error. I've seen this enough in various other languages to know to hoist the function call out of the loop construct.

On the other hand, I'm pretty aghast at the way Java forces you to deal with string concatenation. There is always a trade-off between language purity and getting the job done. The Proper Way to do in Java is one that you are unlikely to determine all by yourself, even if you saw it in someone else's code.

It seems to me that the Java language designers went too far down the purity route, rather than having the compiler do the right thing for you. That's not the best use of costly human time. Make the compiler do the grunt work. Even in C++, an awful lot of effort has gone into building compilers that optimise away intermediate copy constructors and what not. I am surprised that Java compilers are not up to the level that C++ compilers were any number of years ago.

--
g r i n d e r

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://120759]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 23:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found