Whats wrong with java?

Started by
46 comments, last by Washu 12 years, 1 month ago
I've been looking around the web and I've seen a deep hatred towards java? I mean to me it seems like a decent language (then again i'm a noob that doesn't know sh*t about programming other then "If then's" statements.) I also have seen that C++ has a very good rep. can someone explain this to me in VERY VERY LAYMEN TERMS? (noticed how i bolded, underlined AND CAPITALIZED, very very laymen.)
Advertisement

I've been looking around the web and I've seen a deep hatred towards java? I mean to me it seems like a decent language (then again i'm a noob that doesn't know sh*t about programming other then "If then's" statements.)

It is a decent language. Personally, the reason I don't like it as much as say, C#, is that there's a lot of legacy stuff in Java (it's older, and things have changed a lot since it was first released; however, it's also had to retain compatibility with itself from its early youth), plus the fact that I fee like I have to be way more verbose in Java than say, C# (that is, if I want to do the same task in Java and C#, I've typically found that Java requires more code (not tons more, but enough for me to feel like C# is a more elegant, simple solution typically)).


I also have seen that C++ has a very good rep.

The reason you see this is that you've been looking at the wrong parts of the Internet. I wouldn't say C++ has a very good rep. It (and C as well) has a reputation for being very easy to introduce a bug in the code base that you'll only ever find years later after tons of debugging. Yes, it's used a lot in the industry, but that doesn't mean it has a very good rep. (common example: Washu's quizzes. I don't know a single person that's been able to correctly answer all the questions on all the quizzes without cheating)
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
Java also has the unfortunate association of accompanying many college's move away from computer science and towards churning out code monkeys. Plus it's heavily associated with Oracle now, and nobody likes Oracle. Plus java has a lot of badly designed bits (datetime, type erasure in generics).

C++ has a very poor reputation. Maybe a better rep for games in certain circles, but in commercial sectors it's relegated to specific environments where nothing else can go or to vital legacy code.
Some people think the overhead caused by Java's virtual machine technology is unbearable and that's why they "hate" it so much. I personally don't think it's that big of a deal, and there's even one professor at my university who wrote an Othello game using C++ and then ported it to Java, and it turned out the game ran faster on Java, even though it shared the same basic code. When it comes to making games using Java, it's a bit problematic without DirectX support and the lack of proper development environments. One can still make games with it, Minecraft being a good example. :)

The C++'s "good rep" is a bit of an illusion, just like Cornstalks said, it's PITA to find a bug in some cases. And while C/C++ usually offer unrivalled efficiency, it's often too much of a hassle compared to Java or C#. Also, C++ suffers from the huge need of broilerplate code with all the header stuff and whatnot. Everyone has their opinions about these, and they always reflect to their needs and work. I don't really have my own opinions about languages, I prefer C# because I've used it daily for a year, but I don't mind programming with Java or C++. It's a matter of need more than a matter of opinion. :)
Yeah, outside the game development community, C++ has a pretty horrible rep. Often it's use is attributed to being a necessarily evil, which is becoming increasingly less necessary. That said, newbie developers are probably as much to blame about propagating the C++ is awesome meme. Most experienced developers become much more pragmatic in their approach to languages.


As to Java, its a perfectly serviceable language, but it isnt aging well. Basically C# came to the scene, learned from the best of C++ and Java, and thus has less legacy cruft weighing it down. C# is aging better than Java, adding new features that fit well, as opposed to feeling like kludged hacks.


My biggest beef to Java is the ecosystem. There are too many libraries to do too many things, half of which do them poorly. Where for example C# has two windowing systems, Java has about 20, of which only 1 isn't crap. So, as a new developer, you are going to get overwhelmed with options. Hell, just try to figure out which web framework you should use with Java... as a new developer, that experience will crush your will to live.

My other beef is the ecosystem is just horrifically over-engineered, it reeks of consultants. People try to abstract things to the 29th degree, to the point you are depending on some magic XML file, being called by a 3rd party tool, calling another 3rd party tool, accessing a web repository just to display a unicode string on screen. It's the type of thing people paid by the hour do, and its all wonderful and great, until it breaks. These days, you don't just learn Java, you have to learn Ant, Maven, Git, then whichever frameworks you go with. Plus, Eclipse sucks, for much the same reason, too many options, too many tools trying to be too clever and creating a nightmare when they break.
It's slow and not very good for game development on PCs, but on some smart phones (e.g., Android-based phones) it's the language used for coding games. IMO, neither Java nor C++ is noob-friendly due to their myriad frameworks and libraries, lack of documentation, and intentional obfuscation. Other languages have similiar problems that make it difficult for new programmers. C++ does have its drawbacks, but nobody forcing the programmer to make things more difficult than it needs to be. It's the design and not the language that is the main issue.

If you want to start simple, I recommend Javascript. It's completely self-contained. There's no need install anything and you won't have to worry about compiler settings and options. All you need is a modern browser.
Legacy (some poor libraries, features that can't be shoehorned in anymore) and verbosity (everything-a-class, no operator overloads) pretty much sum it up.

There's also a lot of hold-over opinions from the early days when JVM performance wasn't that good, and the half-failed promise of "write once, run everywhere".

C# isn't perfect, but its basically Java-done-right (as it was able to learn from Java's mistakes)

throw table_exception("(? ???)? ? ???");

There's nothing specifically wrong with Java itself - in the right environment and when used for the things it's good at, it works. That's good by any measure of success. Like any other tool/language/platform/API/framework/widget, if you try to strongarm it into doing things that it's not good at you will probably end up in deep trouble.

As it was really the first of it's kind it got to make all the exciting mistakes, and the hype originally surrounding it did turn out to be a mite off the mark, but a lot of productive work (as opposed to over-engineered consultantware) still gets done in it.

A large part of the hate - as with any hate - is just down to people being tribal and liking to pick sides in a (potential) fight. You'd probably find the very same from the other perspective if you went looking.

Direct3D has need of instancing, but we do not. We have plenty of glVertexAttrib calls.

The biggest negative to Java has to do with corporate machinations about a decade ago. The result was that Microsoft made sure that end users would have a hard time installing the Java runtime on their Windows boxes, but the C# runtime (aka .NET, then later the CLR) worked out of the box. So, to distribute your Java application you need to bundle the entire Java runtime, which is not tiny and useless if you do not have big bandwidth. Distributing C# apps means a tiny bytecode file download.

Microsoft also ships the C runtime and some C++ runtimes.

In summary, the disadvantage of Java is that it is a hassle to distribute apps for Microsoft Windows written in Java compared with apps written in C# or C or (in most cases) C++.

Stephen M. Webb
Professional Free Software Developer


In summary, the disadvantage of Java is that it is a hassle to distribute apps for Microsoft Windows written in Java compared with apps written in C# or C or (in most cases) C++.

Worth mentioning that Apple no longer pre-installs the Java runtime (although it will offer to do so when you try and run a java application), and most Linux distros now have multiple available JREs, each with their own caveats and/or bugs.

It's all a bit of a mess.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

This topic is closed to new replies.

Advertisement