By bloid
via techper.net
Published: Aug 28 2008 / 23:43
Back in the days of Java1, two cool parts of this new platform was the threading apis and the JDBC apis. These APIs have both had immense success. But I think we, as application developers, should forget about them. I know I mostly have.
Comments
zynasis replied ago:
you've got to be kidding me.
it depends on the software and field your in.
henk replied ago:
Although it indeed depends on the field you're in, there does seem to be a tendency to move away from lower level constructs. We've seen a similar thing happening with native arrays. There was a day when the native array was the bread and butter of a Java developer. Recently, I don't see it being used a lot. The majority of the people seem to prefer something like ArrayList.
Sure, if you're in scientific computing working with native arrays, primitives, bytes and byte-wise operators are your thing. But really, how many people are in scientific computing AND using Java?
So "gone" is a big word, but I do think that the need has (greatly) diminished for the average programmer to use the Thread class and the sql package.
raveman replied ago:
come on man, do you think everybody knows those new APIs? Array has better performance than ArrayList, plus why learn this new API? We dont need no level of abstractions. Arrays rules.
henk replied ago:
>Array has better performance than ArrayList
Did you actually measured this in real code? Premature optimization is the root of all evil. You do know that, right? Sure, if you insert something in an array 1000.000 times and measure how long that takes vs doing the same thing for ArrayList, then the native array will win.
However take any real code and you'll find that a couple of items, several 100's at most are inserted into an array. The performance difference per request (where request can be an HTTP request or a click on a button in a Swing app, etc) is completely unmeasurable.
Just try it. Take any real world code. Profile it with VisualVM, Jprofiler, etc. Now change every usage of ArrayList by a native array. Measure it again. See any difference... ? I told you :P
raveman replied ago:
come on, i was joking :P just trying to sound like those jdbc maniacs. however i do believe you would gain some nanoseconds if you change all the ArrayLists to Arrays :P and please dont measure it in ms, that is just not fair.
raveman replied ago:
right on, not many of us do the same thing. you might be doing enterprise app for insurance company, i might be doing j2ee app for a bank and mswatcher is doing web app for music store. it sounds the same, but its not. music store needs pure jdbc (dont ask why, please). i use threads in my j2ee apps, because i can. i did not read the j2ee specification and i dont care what is says about not using it. threads are faster than jdbc.
Voters For This Link (9)
Voters Against This Link (16)