Why do people hate Java?



  • Several posts on this site imply that Java is rubbish, I am interested as to why.  I am hoping this thread will be in a similar vain to the one on PHP. 

    I am a C++ programmer who has recently starting doing a little Java and so far it seems fairly good, the bits I haven't liked are:

    - no RAII so some resource management is manual e.g. closing database connections

    - checked exceptions - but you can get more sensible unchecked behaviour by writing 'throws Exception' so I don't find this much of a problem.



  • Java is a perfectly good language overall.  I think there are two things people generally don't like about it:

    1) It can be comically verbose when you do things the "right" way, and

    2) Swing sucks more than you can imagine.

    Steve Yegge can say it better than I:  http://steve.yegge.googlepages.com/tour-de-babel (scroll down to the Java section).



  • @MET said:

    Several posts on this site imply that Java is rubbish, I am interested as to why.  I am hoping this thread will be in a similar vain to the one on PHP. 

    I am a C++ programmer who has recently starting doing a little Java and so far it seems fairly good, the bits I haven't liked are:

    - no RAII so some resource management is manual e.g. closing database connections

    - checked exceptions - but you can get more sensible unchecked behaviour by writing 'throws Exception' so I don't find this much of a problem.


    I don't know for others. I don't hate Java, I just find it far too verbose (the compiler still not being able to perform local type inference is... distasteful), lacking some concepts I grew to like a lot (higher-order functions, pattern matching, tuples & destructuring assignment, literal syntaxes for maps and arrays/arraylists).

    Which is part of the reason why I plan to check on Scala, looks like a very nice JVM language.

    Plus Scala implements an Erlang-like actors-based concurrency model instead of java's threads.



  • I will at some point be surrounded by people who don't know how to code, and they will do far less damage with Java than with C++.

    Now that's a great arguement 😃

    What I like when looking at java (thinking from my C/C++ background):

    • strings. OMG give me easy manageable strings that don't suck.
    • virtual function calling from constructors. Yes, I know, members haven't been inilized yet. But I didn't need members, I need modified actions. Why does a language that allows loads and loads of unsafe shit (C) not to call virtual functions from a constructor?



  • @MET said:

    you can get more sensible unchecked behaviour by writing 'throws Exception' so I don't find this much of a problem.

    Oh dear. If you must, wrap Exceptions in RuntimeExceptions, but getting every method to throw Exception? Real WTF in the works there.

    I believe Java gets a tough rep here because TheDailyWTF has been a long-time refuge for Microsoft apologists. It's a great language.


     



  • I hate the Java standard library because it's full of poorly thought-out rubbish like Swing, and ends up having several different ways to do things because new versions were added to fix the stupider parts of earlier ones, with each different variant having different sets of bugs and some of them just being plain wrong.

    The Java language isn't really all that repulsive - but it's not all that good either. I'd give it a resounding "mediocre". It gets a few things right, but misses out on most of the best ideas about language design that have come up in the past 10 or 15 years (type inference, true polymorphism, naturally parallelisable code, a whole host of performance-related features, non-trivial namespace manipulation, ....)

    It could have been much better. It wasn't. 



  • @asuffield said:

    It could have been much better. It wasn't. 

    Worst part is that one of the designers wanted to add the advanced features some people are now asking for (anonymous first-class functions with closures and stuff), but the others didn't see the point (blub syndrome to re-use the expression) and just wanted to ship it.



  • Java is still suffering from the bad reputation it acquired in the mid to late 90's.

    It hit the scene pretty big in '95 claiming that it was the solution to all the world's problems.

    I remember some of the books I owned back then on Java...huge 1000+ page tomes on how Java was the future...and Java this and Java that.

    Well, the reality of the matter was, back in '95 nobody's home PC could run the stuff. So our machines crashed. And they crashed hard.

    People were soured on Java for years. The programmers were paid very well of course. What they built which was so wonderful and justified their salaries still mystifies me. Although I do remember so many shimmering water applets...

    Nowadays, Java works well on your average PC. But then again, so does .NET. So instead of Java being this "golden child", it's just another option.

    I think people hate Java because of their past experience with it. I struggled through those PC-crash days, so I guess I would fall into the hate camp. 



  • Swing has become better (IMO a lot better) in 1.5. Faster, less bugs. Other than that, I aggree with CPound. Hard to believe, isn it? 😉

    What I like most about Java is the true plattform independence. I write Java apps on my Linux box and deploy them on Windows PCs. They simply work. I also like the comprehensive standard libraries and the good stuff that comes from Apache (Jakarta), Jasper and others. Report generation, export to Excel - all done without proprietary third-party components.

    What I hate most about Java, and the word "hate" is even euphemistic, is the abundance of frameworks. Useless frameworks. Redundant frameworks. Complicated frameworks. Short-lived frameworks. It seems to me that when some programmers noticed how easy software development is with Java, they desperately looked for ways to decrease productivity, to create an artificial lack of manpower so the wages stay high. They invented frameworks, and the succeeded.



  • @ammoQ said:

    What I hate most about Java, and the word "hate" is even euphemistic, is the abundance of frameworks. Useless frameworks. Redundant frameworks. Complicated frameworks. Short-lived frameworks.

    Amen, brother.  Because of yet another "standards readjustment" where I work, I've got this year to look forward to forgetting all the Struts I had to learn a couple years ago.



  • Java in in certain ways a fine language, and in other a less fine one. The love-vs-hate thing going on is, as almost always in such situations, misguided: Java, as any language, is a tool. Tools are generally speaking specialised (even when called "general-purpose" and suchlike) and more or less suitable for certain problems. That said, what I personally perceive as problems with Java is

    In contrast to f.i. C++ Java misses some language constructs. Most recognisable among these is multiple inheritance, without which it can be argued to be less than a fully object-oriented language, and operator overloading. To leave out MI means that many OO solutions cannot be implemented under Java. Leaving out operator overloading means that any object manipulation must go through method- and linked methods syntax and prohibits you from allowing natural and arithmetic syntactic manipulation of instances. The probable reason for leaving these out (especially MI) was likely to keep the compilation model simpler, but the utterly false and FUD-ish market reason was that "MI and operator overloading leads to error-prone and difficult-to-maintain" code, which is unsubstantiated rubbish.

    Compared to f.i. Ruby and Python (iirc) Java misunderstands the meaning of "fully Object-Oriented": Java claims to be fully object oriented in that everything in Java must be encapsulated within the brackets of a class construct, which among other things leads to the quite arbitrary and for beginners incredibly confusing placement of the main function inside the class. In a real object-oriented language everything manipulated is an object, but code can be written as functions - Ruby is the excellent example of this. Countrary, Java retains atomic data types, f.i. integers. This detracts from the aesthetics and principles of the language, leads to counter-intuitive and forced constructs as the placement of the main [i]method[/i] and wrapper classes for atomic data types.

    Java, which begun as a very focused and sleek design, has turned into a pincushion of a language, pointing in all directions at once. The focused concept has turned into a unwieldy behemoth.

    The previous point is exacerbated by that today it is principally unavoidable to write Java applications without incorporating multiple, often extrvagant numbers of, external frameworks of which you often only need a limited functionality. Java proliferates in packages and frameworks, and often turns the act of programming into one of code archaeology.

    Then we have the "portability" argument; Java is often called a "write once run everywhere" language, but a common criticism is that a better phrase would be "write once tune everywhere", reflecting that JVM implementations are anything but uniform and writing full-scale applications is in fact very involved and not thus not really platform-independent, albeit in a different way from in compiled languages.

    Lastly, Java is increasingly being used as the first language in programming education. This is a mistake due to several factors. Java is really confusing for beginners due to its arbitrary mix of paradigms and designs: object-orientation and atomics, and try to meaningfully explain the void public static main() inside a class for newbies in a lecture and you might understand. Secondly, starting to code in Java teaches you dangerous habits, among others acquiring resources without thinking about deallocating them and a certain wantonness and laxness to allocating resources and including external packages.



  • Why do people hate COBOL?

    And of all those who hate COBOL, how many even know what a COBOL program looks like?

     



  • @newfweiler said:

    Why do people hate COBOL?

    And of all those who hate COBOL, how many even know what a COBOL program looks like?

    C code:   c = a * b;

    COBOL: MULTIPLY A BY B GIVING C 

    The bad memories from 2nd year university COBOL class are flooding back.  Honestly, it's a really easy language to learn, but god it's just so strongly typed.

    I remember we did this one assignment in class.  Two different groups of people writing the same assignment in COBOL.  One was 2000 lines of code.  The other was 200 🙂

    Back when we didn't have 1600x1200 32bit desktops, this was the most powerful "GUI" language there was, in my opinion.  You could do some pretty wicked things with just a little bit of code/configuration.  You know all of those point of sale screens you see with the old monochrome monitor, all in text mode?  You could whip up one of those in COBOL in no time.  Of course finding a good use for COBOL nowadays is pretty tough, other than maybe for a history class.


    And yes, I know people who are STILL actively programming in COBOL... sad as it is. 



  • @newfweiler said:

    Why do people hate COBOL?

    Because it sucks like hardly any other language sucks (Since I don't know ABAP in detail, I can't say for sure "like no other language sucks").

    Hardly any other language encourages the creation of copy-paste spagetti code with lots of global variables like COBOL does.

    It got better with COBOL-85, but since most COBOL programs are legacy programs, that doesn't help much.

     

     

    And of all those who hate COBOL, how many even know what a COBOL program looks like?

    In my case: Definitely yes, though fortunately I don't haven't had to write COBOL code for the last 18 years.

    The last COBOL code I've seen, about 4 years ago, was still spagetti code with lots of GOTOs and PERFORMs.


  • @Mikademus said:

    In contrast to f.i. C++ Java misses some language constructs. Most recognisable among these is multiple inheritance, without which it can be argued to be less than a fully object-oriented language, and operator overloading. To leave out MI means that many OO solutions cannot be implemented under Java. Leaving out operator overloading means that any object manipulation must go through method- and linked methods syntax and prohibits you from allowing natural and arithmetic syntactic manipulation of instances. The probable reason for leaving these out (especially MI) was likely to keep the compilation model simpler, but the utterly false and FUD-ish market reason was that "MI and operator overloading leads to error-prone and difficult-to-maintain" code, which is unsubstantiated rubbish.

     Just wondering, can you give me an example where multiple inheritance is really necessary and cannot be replaced by interfaces? I cannot think of any.
     



  • I am now deterred from attempting to become a Real Boy via Java.

    Fortunately, two helpful smurfs I know from another forum have smurfed me into the right direction for Ruby experimentation.



  • To me, Java is wonderland. C++ forces me to spend 90% of my time thinking about how, and not what to implement. Python is a nice hack, with better bindings to low level stuff, while still maintaining a nice high-level scripted feeling. On the other hand, Python doesn't give me type checking and feels generally less professional. C# is like Java, but is overly complicated. I don't like the massive use of redundant keywords. .NET generally is also nice, but gives you vendor locking. Badly. I respect Perl and love it, but it's not for everyday coding.

     Java gives me true power. You have heaps of great, free libraries, toolkits, make utilities (ant, maven), application servers (Jboss, Tomcat etc) and really nice IDE:s. I don't feel restricted while using Java. I know that there is almost always a solution to any possible upcoming problem, and that the solutions are almost always good (Enterprise level persistence, cache solutions, image manipulation, great GUI components (yes, i love Swing, it beats the crap out of .NET), great webservice support, you name it). You also have platform independence and can choose another language if you feel like it (JPyton, Scala, Groovy etc).

     The only negative side to this is partly speed (which is not really a problem since my general impression is that it's much easier to write good code in Java, compared to for example C++), and RIIA. RIIA is actually a bad problem, and requires a lot of redundant coding. The new trend with resource injection (SEAM etc), fixes this in a nice way though. So, all in all, Java rocks.

    Thats my five cents.
     



  • Things I don't like about Java:

     - EJBs and container-managed persistance. I think a lot of old hands are sticking with, or moving back to, session beans and POJOs (plain ol' Java objects). But, last I checked (which, admittedly was a few years ago), container vendors were pushing hard on how well their shit supported this stuff.

     - Giving up a "safe" container for speed. This can be a nice thing too, being able to choose when you want to shoot yourself in the foot, but doing something like tuning a hotspot jvm on a HPUX 11i box just to watch it core dump because one developer on one team wrote a bad recursion function can ruin your night.

     - CLASSPATH

     - It's everything to everyone. This is a blessing and a curse... but think about the choices you need to make when you start a project and, especially if you don't have a clear understanding of what's out there, it's too hard to get where you want to be... standard JSPs, struts? log4j, logkit? hibernate, the container's cmp? spring, pico? Plus all of the libraries at your disposal... don't get me wrong, I love the toolset, but, if I was approaching it as a novice to the language, there is a definate impedence to getting started.

     - Checked exceptions. Again, this can be a powerful thing once you understand it, but, in my opinion, it forces something about the runtime into the design contract that I don't like. And, again, it's a level of impedence that a beginner isn't going to appreciate.

    Things I like about Java:

     - All of the tools that have come out of the community... spring, struts, hibernate, ant, anthill, junit, log4j, maven.

    Now, honestly, I'm super-biased, but, I'm gradually moving to Ruby. I'd recommend looking into that language a bit more and comparing it against your C++ and Java experience. The biggest thing I like about Ruby, especially when you combine it with Rails or Camping, is the utter lack of impedence to start. It's a language that you can have going in four minutes on a clean machine and have a reasonably cool working example in another 10 minutes. It's a wonderful experience if you've never encountered a language like that before.



  • @bouk said:

    @Mikademus said:

    In contrast to f.i. C++ Java misses some language constructs. Most recognisable among these is multiple inheritance, without which it can be argued to be less than a fully object-oriented language, and operator overloading. To leave out MI means that many OO solutions cannot be implemented under Java. Leaving out operator overloading means that any object manipulation must go through method- and linked methods syntax and prohibits you from allowing natural and arithmetic syntactic manipulation of instances. The probable reason for leaving these out (especially MI) was likely to keep the compilation model simpler, but the utterly false and FUD-ish market reason was that "MI and operator overloading leads to error-prone and difficult-to-maintain" code, which is unsubstantiated rubbish.

     Just wondering, can you give me an example where multiple inheritance is really necessary and cannot be replaced by interfaces? I cannot think of any.

    Mixins. Java can't do them at all. Multiple inheritance is not the only mechanism for implementing mixins, but it is one of the simplest (and the one used in C++). Java users tend to end up abusing things like AspectJ to do it instead.
     



  • @webzter said:

    Things I don't like about Java:

     - EJBs and container-managed persistance. I think a lot of old hands are sticking with, or moving back to, session beans and POJOs (plain ol' Java objects). But, last I checked (which, admittedly was a few years ago), container vendors were pushing hard on how well their shit supported this stuff.

     - Giving up a "safe" container for speed. This can be a nice thing too, being able to choose when you want to shoot yourself in the foot, but doing something like tuning a hotspot jvm on a HPUX 11i box just to watch it core dump because one developer on one team wrote a bad recursion function can ruin your night.

     - CLASSPATH

     - It's everything to everyone. This is a blessing and a curse... but think about the choices you need to make when you start a project and, especially if you don't have a clear understanding of what's out there, it's too hard to get where you want to be... standard JSPs, struts? log4j, logkit? hibernate, the container's cmp? spring, pico? Plus all of the libraries at your disposal... don't get me wrong, I love the toolset, but, if I was approaching it as a novice to the language, there is a definate impedence to getting started.

     - Checked exceptions. Again, this can be a powerful thing once you understand it, but, in my opinion, it forces something about the runtime into the design contract that I don't like. And, again, it's a level of impedence that a beginner isn't going to appreciate.

    Things I like about Java:

     - All of the tools that have come out of the community... spring, struts, hibernate, ant, anthill, junit, log4j, maven.

    Now, honestly, I'm super-biased, but, I'm gradually moving to Ruby. I'd recommend looking into that language a bit more and comparing it against your C++ and Java experience. The biggest thing I like about Ruby, especially when you combine it with Rails or Camping, is the utter lack of impedence to start. It's a language that you can have going in four minutes on a clean machine and have a reasonably cool working example in another 10 minutes. It's a wonderful experience if you've never encountered a language like that before.

    I'll add a few likes and dislikes-

    Likes:

    -Some awesome GUIs with crippled GUI toolkits.

    -Reasonably fast application execution once the code has been cached.

    -really easy to see what is going on with source code; Easy to comment on.

    -Framework.

     

    Dislikes:

    -Crippled GUI toolkits.

    -Everything's a friggin class.

    -Doesn't do everything fast.

    -Fairly wordy language.

     -No stock IDE (although there are some really nice ones)

    As it pertains to your "working example in ten minutes" VB.NET has that sort of learning curve, especially for console apps. I'd never done a windows form before in my life and i had an alarm clock application written and working in about 30 minutes - the longest part was trying to figure out how to get an mp3 to play. Furthermore, i did a client/server chat client that allowed any copy of the application to act as a server and have multiple people connect in about 3 hours, most of that was spent looking up threading - another thing i had never intentionally done before.

    I dunno, both Java and VB.NET (and all common .NET dialects) have really nice documentation, and a widespread developer presence on the internet. if you really can't figure something out, you're probably approaching the problem wrong.

    I'll stick with .NET rather than java for now, and maybe look into ruby (i haven't heard anything really bad about it on these forums yet... i'm just wondering what it can do... isn't it a powerful scripting language, rather than a high level compiled language?)

    thanks for reading!


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.