Earlier quoted context omitted.
> I like being a pedantic programmer. Try Scala! (So do I ;)
shouldn't that be Try Scala! (So do I ;)) then?
(So do I ;\))181–190 of 218 posts
Earlier quoted context omitted.
I have to say, I think it's easier to verify the correctness of [31, isLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][M-1] than your formula. Even a dictionary wouldn't be bad. And if it were wrong, it would be easier to fix it.
Correctness should be verified by tests not 'looking at the code'. The aforementioned code can never be verified as correct because February requires a year to be present to know the number of days. Doesn't java have a massive calendar library to address exactly these sorts of human questions? I mean sure you'd still be looking at code like: public int getDaysInMonth(DateTime date) throws CalendarFactoryFactorExcepti…
Earlier quoted context omitted.
No, this has changed. With the start of Lion Apple is no longer the gatekeeper and as was previously reported they are working with Oracle to create new releases of OpenJDK which is why people like myself are wondering where the release is since Apple was stepping away from being the gatekeeper.
Apple is still the gatekeeper in Lion: there are a ton of hooks that auto-install Apple Java via Software Update when it feels you need Java, like running into an applet or invoking the java command line binary. In the future, they plan on placing Oracle in that role, I guess, but it hasn't happened yet. All Lion does is change it from shipped with the OS to not.
Earlier quoted context omitted.
Ahh, good point. I'll add that to Java 8 hotness list. Thank you. UPDATE: Couldn't add it to the original post (edit has expired), here is more info about Joda Time for Java 8[1] for folks that are interested. [1] http://www.jroller.com/scolebourne/entry/what_about_jsr_310
> here is more info about Joda Time for Java 8 JSR 310 is not Joda for Java 8 (or 7). It's by Joda's author and uses a very similar API, but it's a cleanroom implementation and not compatible with Joda: over time, Stephen Colebourne (Joda lead dev) found core issues in Joda, and JSR-310 is the occasion to use the lessons learned from Joda.
Earlier quoted context omitted.
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 wonder why it doesn't just switch on the ordinal directly. 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 ta…
That was my first thought as well, but I double checked and the ordinal() method is final, so you're guaranteed not to get anything other than continuous values for your enums.
> in C compiled to x86 assembly language, a switch statement on (mostly-)contiguous values can be converted into a jump table
Ah, this is probably the intention. The JVM can probably optimize the switch. I just checked it, and when there are multiple switch statements in a class only using a few values in an enum, it tries to make them all sequential in the switch, that's why it uses the array. I guess it's just a mistake (or lazy coding) that it always makes the array size TheEnum.values().length rather than how many it's actually going to use.
Earlier quoted context omitted.
yeah but Sun was sold, and other stuff happened. I think it's already great that there is a release with some syntax features that are useful and other nice to have things too. I think Java 8 will come fast there are plenty of new langs now they can't miss the point otherwise companies will continue to migrate to faster evolving languages with faster developing times.
>>faster evolving languages with faster developing times. Could you provide citations of any studies done please. i.e. How development times differ for small projects and large projects. For small projects I could see other languages being faster, what about large project or really large projects?
Earlier quoted context omitted.
they had that, it is called silverlight. People didn't want it all that much.
Silverlight is still limited to Windows and Mac. Moonlight is from a third party and doesn't count toward Microsoft's community altruism score.
Earlier quoted context omitted.
I know why he gets downvoted: There's a lot of kids on hacker news that only use ruby and/or javascript and they really don't want to hear about them being bad at something. hell they wrote a WEB APPLICATION. Now ain't that something.
That's just foolish. I write Java daily for a very large web company, and I downvoted him. Because his claim is nonsensical. I downvoted you too, because your claim is trollish and wrong. I have been writing Java since I was 13. I am 23 now. I have been paid for code written in C#, Java, JavaScript, PHP, F#, and Python. My personal projects are written in Scala, C#, C++, and JavaScript. I emphatically do not use Ruby…
Woah! You're 23? I bow down to your knowledge and wisdom ;) (I started programming before you were born).
> I am quite certain that I would be vastly more productive if the language wasn't consistently getting in my way
Again, then you're doing something seriously wrong. If you're spending more than 25% of your time typing out code, you're doing something very very wrong.
If your bottleneck is the language, there's something seriously fucked up with the way you program. As a programmer you should be primarily using your brain, to solve problems. Then you take a few minutes to splurge that all out by pressing some keys on a computer.
Earlier quoted context omitted.
> 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.
> And if you can't read code well, go practice some more. Actually, let's not. To paraphrase a minor celebrity of programming, life is too long to be good at reading every variation of boilerplate. Java is essentially hostile to small functions and parametrization, as having any semblance of inner or anonymous functions will require you to define a class at least, or an interface somewhere else, scattering your code…
Learning to read code is just like learning to read English. You can guess most of the words meaning once you know some of them. Personally, I think being able to read code is the best skill you can have as a programmer. Just as a good musician is able to listen to music properly. (I mean 'listen' as in analyze, understand, notate and copy).
The other point IMHO is that scattering your code with anonymous functions points to bad design and is as bad as scattering "GOTO" everywhere in BASIC code. It leads to spaghetti code which is an unmaintainable mess.
Earlier quoted context omitted.
You are basically saying that people cannot write good code in Java. You are generalizing and that makes you sound like and troll even though I know that is not your intention. You can write good or bad code in Java. I personally have never really had an issue with Java so I don't really understand the hate. Yes, there are sucky frameworks out there but you do know that you don't have to use them? Either I'm writing…
>> 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…
Wake up. You're 23. You're a kid. You've just started programming and think you know everything. You don't.