Note to myself: Another reason why I don't like Java

Posted on:February 05 2008

I noticed this some years ago, but somehow my mind has suppressed this realization. Until I found myself in a discussion with a java programmer some weeks ago which was like this:

Me: Yes, but why don't you simply use an unsigned int? Twice as much numbers for the same price! :)
Him: Unsigned what?
Me: Unsigned int. No sign. Unsigned.
Him: ?

Yep, and there it was again. Java does not have unsigned types. What a superior language. Who needs unsigned types, right? :)





Comments:


I dont get the whole java thing too. I dont know why someone would like to use a slow language which is hard to code ... at least for me xD

and always this "you can use it on every os" ... pfff ... you are paying a huge performance price for that ... and to be honest: c++ is also portable to every os. it just depends on the coder.
jens
Quote
2008-02-05 18:08:00


That and it's slow as shit. Nuff said.
Joseph Smith
Quote
2008-02-05 18:27:00


Slow? You're kidding, right? Java outperforms C++ in almost any benchmark (except maybe when memory bandwidth is an issue). See for example

http://www.kano.net/javabench/
http://www.shudo.net/jit/perf/

Please take a look at the linpack benchmark in the second link where Java is almost as fast as C. Or at the method calls benchmark in the first link - C++ can never beat the JIT when it comes to method calls.
David Tanzer
Quote
2008-02-05 18:55:00


I don't know how those people got their benchmarks, but there's a reason that 3D games do not use Java: speed.
Michael
Quote
2008-02-05 19:01:00


Sorry, my first link is a little bit unfair because the C++ code can be optimized in many cases. Still, the method call argument holds, here is a revisited benchmark:

http://www.freewebs.com/godaves/javabench_revisited/
David Tanzer
Quote
2008-02-05 19:02:00


One Word: Awesomeness
MasterGod
Quote
2008-02-05 19:12:00


Java was never meant to compete directly with native code, speed comparisons are not the point. That said, Java is actually easily fast enough for the things it does well.

Lack of 'unsigned' was to make it a simpler language to learn and to make it less likely to introduce hard to spot bugs. Converting from unsigned to signed and vice-versa can obviously lose information, and if you allow it you open up a whole can of warnings and potential esoteric problems. Anyone who has ever fallen foul of the 'unitary negation on an unsigned variable produces unsigned results' issue in C++ should know what I'm talking about.

Java isn't C++. Nor is Python. Language comparisons are largely pointless, IMO, each one is designed from a particular standpoint and the strengths and weaknesses are linked to using it in that context. If that's not appropriate for your app, use another language, don't bitch about it ;)
Steve
Quote
2008-02-05 19:26:00


There are quite a few reasons why Java doesn't suck. As non-scripting languages I use mostly C++ and Java. C++ when I need to for various reasons, and Java when I can, which is when it is more or less equally capable or better for the job at hand.

My personal main reasons why I like Java:

* Together with a good IDE, Java has very short turnaround time compared to C++. A fluent work cycle is important to me.

* Java has the best IDEs. While I prefer Eclipse/JDT, even new netbeans and IntelliJ are far better than Visual C++ in terms of code centric development and support for agile development methods. Compared to Java IDEs VC++'s code completion, code navigation and refactoring capabilities are a joke. 3rd party tool integration in Eclipse is far better too.

* The Java language is more consistent than C++. No C-millstone to drag along. Exception handling and package concept tightly integrated. So that they are actually universally usable. I don't like using the half-assed exceptions approach in C++ and every project seems to use it differently and it is hard to control consistency.

* Java development is more standardized than C++ development. By this I don't mean the compiler quirks, but the whole development process. Java code from different projects looks much more alike than C++ code from different projects. And not just the code itself, but things like packaging and building. In C++ you have VS-Solutions, makefiles, cmake or whatever, in Java you have ant, which is strongly supported and integrated by most IDEs, build tools and projects.
haffax
Quote
2008-02-05 20:28:00


My favourite quote about Java still has to be:
"Saying Java is good because it works on any OS is like saying anal sex is good because it works on any gender."

Note: the above is for amusement purposes only, flames can be directed to /dev/null plzkthx
Kemp
Quote
2008-02-05 20:52:00


@haffax I also use Java and C++ and Eclipse is a good IDE, but Visual Studio with the right plugins is much better, especially the codecompletion is the best i have seen so far and i have searched a long time:) . But the c build process sucks, there is java way ahead
mirlix
Quote
2008-02-05 21:16:00


mirlix, what plugin? VisualAssist? I tried it and it is indeed way, way better than builtin IntelliSense. But nowhere near what Eclipse does.
It does not have quick fixes/assists, quick renaming is not quite so quick and templated code generation is more flexible in Eclipse too. Where exactly is VisualAssist(or your plugin, if different) better?
Especially the quick fixes and quick assists are what speeds up development for me and VA is very basic in that regard when compared to Eclipse/JDT.

Actually quick fixes make me lazy. Why create a field myself, if can just use it in code and press CTRL-1, down, enter, enter and this is done. Complete with type inference, proper field placement and everything. It has been a while but when I tried it, VA was not able to do something even remotely like this.

Also all static code errors are marked immediatly, if you want them to. Not so with C++, whether you use VA or not.

So I am pretty sure here that Eclipse/JDT is in front by a long shot. But I am really curious here about what plugin for VC++ is better and where. I am always interested in improving knowledge and skills in C++. :)
haffax
Quote
2008-02-05 21:54:00


i never used quick fixes, so i cant say much about. i will take a look when im back on a computer with eclipse installed. The static code errors are really a nice thing, but it seems to my that the codecompletion of visual assist is much better then the one of eclispe, maybe i do something wrong. I dont know which version of visual assist you used, but i download a new one and the refactoring features work as good as the one in eclipse, i think.
mirlix
Quote
2008-02-05 22:05:00


c# has unsigned ints
so its better than java :D
c# fanboy
Quote
2008-02-05 22:14:00


mirlix, well "much better code completion", what does it mean practically? I doubt it, after looking at the feature list of current VA, the core caps should be about the same in regards of plain code completion. And in regard of refactoring VA is definitly poorer than Eclipse by looking at the feature list alone. 10 refactorings in VA to 26 in Eclipse and important (as in often used) refactorings completely missing. (Push up/Pull down/Extract Superclass) 3 of the 10 VA refactorings aren't even refactorings in the real sense of the word. "Create Implementation" and "Create Declaration" is C++-only but would be a quick fix in Eclipse and "Document Method" is not a refactoring either and Eclipse can do this too and in Javadoc compatible format and not only for methods like VA.

I guess this discussion becomes tedious for passersby, but as long as we don't come to the core of it, I'm not going to stop. Sorry for that. :)
haffax
Quote
2008-02-05 22:44:00


At the and of the day this is just another geek talk: is my hammer better then your hammer! Have you ever think that every hammer is good for a specific task/person. How about when is Irrlicht is going to move from a novice library to a more pro approach?
Totoro
Quote
2008-02-06 07:50:00


I don't think it is a problem of Java that that developer doesn't know unsigned types.. Ok, Java doesn't have them, but in my opinion the developer still needs to know what kind of thing it is. In other words, the developer should know more then one language. (starting with Smalltalk :P)
David
Quote
2008-02-06 09:48:00


Oh Language Troll! Language Troll! Ok let me try:

Unsigned integers are a strange beast when you consider languages as Java or C#. Although C# supports unsigned values, I've rarely seen any code that uses them, despite the fact that I think they provide a good solution for cases where it makes no sense to have a negative value.

I think that part of the problem that few people use unsigned integers in C# (or that there isn't any in Java) is like the fact that it's hard to find const-correct code in C++ : it's difficult to make such code when you deal with third-party libraries or even code from colleagues that doesn't use these good practices. It's not that it's unfeasible, just that it gets hard to make good use of unsigned integers when you have to deal with code that just always use signed integers.

Also, if you think that unsigned integers are a great practice and that Java is teh suxxor for not using them, well you should look at Java's "checked exception". Checked exception are a great concept, and a good practice imho: they basically say that if you use a method that can throws a checked exception, it is your duty to catch this exception in your code (or declare that it can throws the exception). But, you know what ? There are people in Java land that think that "checked exceptions" are bad, and even the C# designers decided not to include them.
Why ? Because as often, theory is different from practice, and many people noticed that in many enterprise projects, some lazy programmers where just "swallowing" these exception, meaning that they were using empty try/catch blocks around the methods that were throwing these checked exception. And that takes some pain to debug such swallowed exceptions. So, beware of these "good practices", they might not always be your best friends. :)

Ok and finally, language wars are getting old. So Java doesn't have unsigned integers ? Ok that sucks, but C++ doesn't have reflection and that sucks too. Seriously, I've used C++, Java and currently use C#, and I love all these languages. They aren't perfect, but you learn to deal with their shortcomings. Enough said !
Ketzal
Quote
2008-02-06 11:23:00


Okay, a few words: I used Java, C++, C# and some others. And so far I can't see why many people say, Java would be more consistent and easier to learn. I never ran into so many "Well, it's just... ehm... not possible. Don't know why - but it's like it is." For example creating arrays of template types. Or overloading operators. Java-builtin type String does it - I'm not alowed. That's just not fair ;D Or arr.length - public members? WTF? OOP? And why are all the members are by default internal? And Java-GUI-Programming just sucks. Not compared to C++ - comparing these two is like comparing the taste of pizza to that of bred - you CAN compare it, but it's pointless. One is not a proper replacement for the other. But compared to C#-GUI-Programming it sucks. And Eclipse compared to Visual C#? Come on, I hate it, when I've got to switch to Eclipse. Every single time. And I use no plug-ins for Visual C#!
Lino
Quote
2008-02-06 15:59:00


Oh no, not that kidding game again ... Don't you guys have something useful to do?

The only advantage for c++ in my eyes is that you can (mis)use it as an enhanced assembler language when it comes to manipulate memory contents directly. But as always there is no rational argumentation - as it has always been with C64 vs. Schneider CPC, Amiga vs. Atari, 68000 vs x86 and so on.

Even C++ vs Assembler can be compared for speed, ease of use, lines of code etc.

But do not forget the most important thing: it is not the language but the brain using it that makes the difference!
jirr
Quote
2008-02-07 21:36:00


I did not have a need for unsigned ints ever. Maybe it's useful, no idea. I just don't care. We were able to create a game anyway.
Andi
Quote
2008-02-08 13:56:00


Add comment:


Posted by:


Enter the missing letter in: "Internat?onal"


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons