Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

In reply to Re: A peek at the other side or, Poof and He's Gone! by grinder
in thread A peek at the other side or, Poof and He's Gone! by mr.nick

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2024-03-28 21:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found