Earlier quoted context omitted.
I think it is. If people haven't learnt yet that the single most important skill you need as a programmer is being able to read any code, in any language, and take a good guess at what it does, be able to hold abstract programming concepts in your head, and match them up to random code listings you have never seen before.... Before you can write code, you need to know how to read it.
I'm sure no one is disagreeing with the importance of knowing how to read code. I'm just saying that Java makes it harder than it needs to be. If your argument is that that's a good thing, then where does that argument end? (Probably with Perl, I guess...) ...sorry Perl guys. Couldn't resist.
Java 7 is now available
161–170 of 218 posts
Re: Java 7 is now available
#162Earlier quoted context omitted.
Really appreciate you going through the trouble to do that and post the results so we don't need any hand-waving. This looks the same as the original proposal -- using the hashCode and final verification via equals. So in a typical case scenario you have the 1-time calculation of the String's hashCode (which is then cached by java.lang.String) and the two method calls. .equals() is the only thing that could get away…
The .equals() still shouldn't be much of a problem. If you've got a bunch of constants like you gave, they will probably all have different hashcodes so you don't have to compare against all of them. I checked what happens when you use an enum, and it generates some funky code. It creates an anonymous inner class with a static initializer for an array of ints. It uses the ordinal value to assign a sequential number s…
I'll be the first to admit those are pretty slim odds, but it's always fun to dig up these little performance things hidden in the JVM and store them away for later use in some interesting project.
Nice decompile with the enums... no idea what's with the array either; another hidden gem to at least be aware of.
This is alot like when autoboxing came out. New Java people thought int i and Integer ii were the same when used in different settings, not realizing that under the covers Integer.valueOf(i) and ii.intValue() are getting generated.
It's great if valueOf is returning a cached value (-127 to 128) but beyond that you are just object-creating all over the place.
Working on SJXP (xml parser layer that sits ontop of Pull Parser to make it like XPath, but super fast) I did some HPROF and found my use of path hashcode lookups in a Map was generating millions of Objects.
So I moved to an Integer cache that holds the Integer object generated from the hashCode() and re-uses it as needed.
Ended up dropping the overhead (CPU and memory) of the library below everything in native XPP to where it adds almost no overhead.
Anyway -- thanks for diving deep with me on that, we have two new tricks up our sleeves ;)
Re: Java 7 is now available
#163Earlier quoted context omitted.
> New language features are all fun, but unless they actually result in faster execution, or allow you to do things you could not do before, they're only use is to make some developers happy, which I don't think is particularly important. I think you don't appreciate how some language features can help you reduce the size and complexity of your code. Those are the kind of features that are sorely lacking in Java, and…
> Those are the kind of features that are sorely lacking in Java, and that means huge, bloated code bases. No, it doesn't. If you can't write concise Java, you're doing something wrong. And if you can't read code well, go practice some more. Disclaimer: I'm an outlier. I rarely use 3rd party libs, rarely write with anyone else, etc.
Re: Java 7 is now available
#164Earlier quoted context omitted.
Really appreciate you going through the trouble to do that and post the results so we don't need any hand-waving. This looks the same as the original proposal -- using the hashCode and final verification via equals. So in a typical case scenario you have the 1-time calculation of the String's hashCode (which is then cached by java.lang.String) and the two method calls. .equals() is the only thing that could get away…
The .equals() still shouldn't be much of a problem. If you've got a bunch of constants like you gave, they will probably all have different hashcodes so you don't have to compare against all of them. I checked what happens when you use an enum, and it generates some funky code. It creates an anonymous inner class with a static initializer for an array of ints. It uses the ordinal value to assign a sequential number s…
I don't know how JVM bytecode works, or if it's even possible to assign discontiguous ordinal values, but in C compiled to x86 assembly language, a switch statement on (mostly-)contiguous values can be converted into a jump table. If there are large gaps in the switch values, either you have a lot of wasted space in the jump table, you have multiple jump tables, or you fall back to if/elseif/etc-style code.
It would make more sense to me to assign the contiguous integer values during the construction of the Enum, but maybe that doesn't work when Java 7 code tries to use an Enum compiled with Java 6 or earlier.
Re: Java 7 is now available
#165Earlier quoted context omitted.
And only if Microsoft would improve their x-platform vm. Oh wait...
they had that, it is called silverlight. People didn't want it all that much.
Re: Java 7 is now available
#166Earlier quoted context omitted.
>> You are basically saying that people cannot write good code in Java. Wrong. I would not say that, because I do it. I am saying that it is vastly more difficult than it needs to be to write good code in Java because it is insufficiently expressive. I will say that I am suspicious of the ability to write good code of people to whom Java is not a poor development choice, because I suspect brain damage, but a decent p…
Well, lets agree to disagree. Maybe I am a dum*bass and too dumb to realize it. Ho well.. C'est la vie
Are you incapable of substantiating your position?
Re: Java 7 is now available
#167Earlier quoted context omitted.
Well, lets agree to disagree. Maybe I am a dum*bass and too dumb to realize it. Ho well.. C'est la vie
"Agree to disagree" is a polite way of saying "you're wrong." Are you incapable of substantiating your position?
>>Are you incapable of substantiating your position?
The thing is that a lot of the arguments we are making are just our own opinions and hence anecdotal. Really what we need here is scientific research measuring what difference does the programming language make when working on coding projects
A couple of examples that I've worked on are the following:
A Java to Objective-C transcoder
C to Java transcoder
Physics Engine
Collision Engine
Symbolic Math Engine
Game Engine (includes the Physics Engine and Collision Engine along with the rendering and animation code)
And some things I'm currently working on:
Java to C++ transcoder
Java to JavaScript transcoder
What I've noticed is that the coding takes very little time, the figuring out part, the design, architecture, debugging, that takes most of the time.
I'm not really sure whether one of the most modern languages would really make much of a difference if at all. I believe it won't really make much of a difference. Coding is the easy part.
Use the language that makes you comfortable, definitely.
Now, tools are a different story. I would hate to have to code in a simple text editor. IDEs make my life extremely easy and actually make me a faster coder. I love the Eclipse IDE. XCode would be my second choice and Visual Studio 3rd.
Re: Java 7 is now available
#168Earlier quoted context omitted.
Whoo-hoo! Time for the Perl port.
Good luck with that wish.
Not sure if perl6 has the same properties mind.
Re: Java 7 is now available
#169Re: Java 7 is now available
#170Earlier quoted context omitted.
Good luck with that wish.
I would have to lookup the serious academic paper that says peel is technically unparsable in the same ways as PL/1. I think to date there have been two aborted perk on java efforts Not sure if perl6 has the same properties mind.