Wednesday, 1 June 2011

Hate Java? You’re fighting the wrong battle.


One of the most interesting trends I’ve seen lately is the unpopularity of Java around blogs, DZone and others. It seems some people are even offended, some even on a personal level, by suggesting the Java is superior in any way to their favorite web 2.0 language.

Java has been widely successful for a number of reasons:
  • It’s widely accepted in the established companies.
  • It’s one of the fastest languages.
  • It’s one of the most secure languages.
  • Synchronization primitives are built into the language.
  • It’s platform independent.
  • Hotspot is open source.
  • Thousands of vendors exist for a multitude of Java products.
  • Thousands of open source libraries exist for Java.
  • Community governance via that JCP (pre-Oracle).

This is quite a resume for any language, and it shows, as Java has enjoyed a long streak as being one of the most popular languages around.
So, why suddenly, in late 2010 and 2011, is Java suddenly the hated demon it is?
  1. It’s popular to hate Java.
  2. C-like syntax is no longer popular.
  3. Hate for Oracle is being leveraged to promote individual interests.
  4. People have been exposed to really bad code, that’s been written in Java.
  5. … insert next hundred reasons here.
Java, the actual language and API, does have quite a few real problems… too many to list here (a mix of native and object types, an abundance of abandoned APIs, inconsistent use of checked exceptions). But I’m offering an olive branch… Lets discuss the real problem and not throw the baby out with the bath water.

So what is the real problem in the this industry? Java, with its faults, has completely conquered web application programming. On the sidelines, charging hard, new languages are being invented at a rate that is mind-blowing, to also conquer web application programming. The two are pitted together, and we’re left with what looks a bunch of preppy mall-kids battling for street territory by break dancing. And while everyone is bickering around whether PHP or Rails 3.1 runs faster and can serve more simultaneous requests, there lurks a silent elephant in the room, which is laughing quietly as we duke it out in childish arguments over syntax and runtimes.

Tell me, what do the following have in common?
  • Paying with a credit card.
  • Going to the emergency room.
  • Adjusting your 401k.
  • Using your insurance card at the dentist.
  • Shopping around for the best car insurance.
  • A BNSF train pulling a Union Pacific coal car.
  • Transferring money between banks.
  • Filling a prescription.
All the above industries are billion dollar players in our economy. All of the above industries write new COBOL and mainframe assembler programs. I’m not making this up, I work in the last industry, and I’ve interviewed and interned in the others.

For god sakes people, COBOL, invented in 1959, is still being written today, for real! We’re not talking maintaining a few lines here and there, we’re talking thousands of new lines, every day, to implement new functionality and new requirements. These industries haven’t even caught word the breeze has shifted to the cloud. These industries are essential; they form the building blocks of our economy. Despite this, they do not innovate and they carry massive expenses with their legacy technology. The costs of running business are enormous, and a good percentage of those are IT costs.

How expensive? Lets talk about mainframe licensing, for instance. Lets say you buy the Enterprise version of MongoDB and put in on a box. You then proceed to peg out the CPU doing transaction after transaction to the database… The next week, you go on vacation, and leave MongoDB running without doing a thing. How much did MongoDB cost in both weeks? The same.

Mainframes software is licensed much different. Lets say you buy your mainframe for a couple million and buy a database product for it. You then spend all week pegging the CPU(s) with database requests. You check your mail, and you now have a million dollar bill from the database vendor. Wait, I bought the hardware, why am I paying another bill? The software on a mainframe is often billed by usage, or how many CPU cycles you spend using it. If you spend 2,000,000 cpu cycles running the database, you will end up owing the vendor $2mil. Bizzare? Absolutely!

These invisible industries you utilize every day are full of bloat, legacy systems, and high costs. Java set out to conquer many fronts, and while it thoroughly took over the web application arena, it fizzled out in centralized computing. These industries are ripe for reducing costs and becoming more efficient, but honestly, we’re embarrassing ourselves. These industries stick with their legacy systems because they don’t think Ruby, Python, Scala, Lua, PHP, Java could possibly handle the ‘load’, scalability, or uptime requirements that their legacy systems provide. This is so far from the truth, but again, there has been 0 innovation in the arenas in the last 15 years, despite the progress of web technology making galaxy-sized leaps.

So next week someone will invent another DSL that makes Twitter easier to use, but your bank will be writing new COBOL to more efficiently transfer funds to another Bank. We’re embarrassing ourselves with our petty arguments. There is an entire economy that needs to see the benefits of distributed computing, but if the friendly fire continues, we’ll all lose. Lest stop these ridiculous arguments, pass the torch peacefully, and conquer some of these behemoths!

Reference: Hate Java? You’re fighting the wrong battle. from our JCG partner at The Code Mechanic blog.

Related Articles :




30 comments:

  1. I agree with this line of thinking. I feel it is childish to think that one or two or N number of "new" features in a new language make other older languages "evil" to code in. Passionate evangelism of a new language is good as it encourages improvement in others. However, taking other languages down is not productive for anyone. Even COBOL has its advantages. But a lot of these are to do with business and investment rather than the benefits to IT as a whole.

    I have worked in Java for over a decade. I am open to new ideas and techniques, but I can't just brush aside the huge scope of problems that Java can address. I would like to concentrate on improving Java as a language and broadening its scope further by the way of adding more libraries.

    ReplyDelete
  2. "Java, with its faults, has completely conquered web application programming."

    Hrm. Not quite a qualified statement.
    Google? C and python.
    Yahoo? PHP.
    Facebook? PHP.
    Amazon? C and Perl.
    Wikipedia? PHP.

    While I will absolutely agree that Java has huge value and that it is being dismissed these days without merit, saying Java has conquered web development is not a sane comment. If it has, you'd find it in the architectures of the Quantcast top 100, at least. But you don't.

    The post seems like an olive branch that is being swung at people, not extended gently.

    ReplyDelete
  3. to the last commenter: you forgot twitter - they are using lucene and blender ;)

    ReplyDelete
  4. While I'd also disagree with that phrase, I'd point out to the previous commenter:

    Google: Java & C++ power their core applications
    Yahoo: Fairly heavy use of Java
    Amazon: Has been rewriting their site in Java and only sparingly still use Perl

    I'm currently writing Java for a paycheck, though it wasn't intentional when I took that gig. I've never particularly liked Java for one reason alone: it takes much longer to get the job done. That being said, I agree, Java is not at all without value.

    I would prop up one more reason -- what I'd consider the primary reason -- for Java's current dominance in adoption: it is the curriculum language of most universities.

    ReplyDelete
  5. I'm sorry to mention he-whose-name-must-not-be-spoken, but Microsoft is actually targeting the stuff you are talking about - banking software, hospitals, rewriting old super large scale systems, etc, etc.

    Of course I can't expect from a person who thinks that java conquered the web application world :) to see that.

    You know, people up there are not morons, they know why they are still using cobol, and they will switch to something new the minute they see a benefit. This already happened to many companies, now running on .net

    ReplyDelete
  6. So correct. In 2000, we wrote a replacement for an intermodal transport system collection of applications meant to replace 180 separate applications and 28 hardware platforms. It would have saved $10M/year just for starts and not accounting for the improved operational efficiencies. The dinosaur IT guy at the company didn't understand or believe it and shot it down.

    It was in Java with a Web2.0 browser based front end and ran on commodity hardware.

    ReplyDelete
  7. By now its obvious that OOP and design patterns have failed to deliver any of its promises. High level languages without a wink of functional programming and metaprogramming capabilities are obsolete. Its difficult to love the enterprise raviolli code that has become the java culture.

    ReplyDelete
  8. Try reading http://www.paulgraham.com/avg.html (the section on "The Blub Paradox" in particular). The reasons you listed are not the real reasons Java is unpopular with good hackers. But looking at Java from a Java programmer's perspective won't let you see the actual flaws.

    If you want a short list of some of the real reasons Java is unpopular, here's mine:
    -functions are not first-class objects
    -on a related note, no anonymous functions
    -static typing
    -admittedly, C syntax is a problem, but for good reasons, not because its just unpopular
    -poor set of basic types

    To elaborate on the last two, C syntax is on the out because its becoming obvious that a lot of it is unnecessary. i.e. "We indent all our code properly anyway; why require the braces?" Realizations like that are pushing us away from C syntax.
    On the last point, its becoming obvious that the 3 basic types are numbers (you shouldn't have to say how big, or whether there's a decimal point), lists (strings as a subset of this), and dictionaries. Java uses numbers (divided into floating point and integers of various sizes), arrays (fixed-length), and strings (which behave in bizarre ways to get around their immutability plus the lack of proper lists).

    These problems don't make Java a bad language to work in necessarily; they just make it less productive to work in. But honestly, why be less productive than you can? As to the point about how common it is, I'll take the language used by hackers over the one pushed on programmers by managers any day. A language selected by non-programmers is almost guaranteed to be a poor choice.

    ReplyDelete
  9. Finally, a sane perspective on Java :)

    Looking at various speed tests, Java ranks fairly close to c, c++, and c#, and in some cases is actually faster.

    ReplyDelete
  10. To the commenter who mentioned Twitter, I think you’ll find they’re doing they’re core processing using Scala on the JVM. I can’t believe the fadishness of programmers - write in what you like for sure. But be careful what you dismiss, when companies start having large numbers of customers they’re technological choices change fast.

    ReplyDelete
  11. >"Finally, a sane perspective on Java :)"
    From someone who thinks that Java is dominating web applications? Maybe in 1994...


    >"Looking at various speed tests, Java ranks fairly close to c, c++, and c#, and in some cases is actually faster. "
    In *theoretical* or *actual* implementation? Sure, Java might be able to do bubble sort or something as fast as C, but take an actual application written in Java and compare it to something with similar functionality written in another language.

    Try this: Vuze vs. uTorrent.

    It's not necessarily the language itself that is slow, it's how everyone is using it and how slow the shitty libraries people use are.

    ReplyDelete
  12. >On the last point, its becoming obvious
    >that the 3 basic types are numbers
    >(you shouldn't have to say how big, or
    >whether there's a decimal point)

    You don't really know what you're talking about, do you?

    For a start, any language targeting a broad range of applications (web, business, embedded, scientific, 3d games) has to provide abstractions suitable for all of these users. So that means, for example, a range of types providing abstractions over sections of the number line.

    Secondly, even in web applications you'll run into problems the second you start implementing anything more taxing than a web form. How does the interpreter/compiler know which underlying type to use? You'll be wanting to use IEEE-754 for geometric calculations. But totally inadequate for financial calculations.

    > A language selected by non-programmers
    > is almost guaranteed to be a poor choice.

    As would leaving such choices to a clueless script monkey.

    ReplyDelete
  13. IMHO, Java is an popular but ordinary language adequate for allowing mediocre programmers to be productive in a well defined domain environment. However, I feel creative/innovative types often find the language difficult or inefficient to express themselves in. (For example, someone above mentioned the lack of FP capabilities.)

    So, since I also believe the typical blogger is anything but ordinary, it follows a majority might not exactly sing the praises of using Java for any new or innovative thing they happen to be interested in blogging about.

    ReplyDelete
  14. Java is a decent fit for enterprises with large teams of mediocre programmers, precisely because of many of the previously mentioned limitations. It's just harder to shoot yourself in the foot.

    That said, there are some things it's just terrible at. Any sort of binary data, stream or string parsing (all those types but no unsigned ints?!) for one.

    ReplyDelete
  15. Two words: programming hipsters.

    ReplyDelete
  16. I haven't had much direct experience with Java, but from what I've seen, the language is OK, but the libraries are horrible, nightmare-inducing mazes of meaningless complexity. One of the promises of OOP was making the use of the language more powerful, and thus more concise. In my experience the Java libraries make your life harder by requiring so much cookbook code to do basic things, which is the same problem Microsoft always used to have with MFC and only seems to get worse with every new layer they cram in between you and the silicon.

    Maybe things are better now, but it's seldom the language that's ever the problem, but libraries which are overly complex, poorly documented and unpredictable.

    You can write clean code in any language, but few people ever do. I don't think most can, and that includes all the biggest, most successful companies in the industry.

    ReplyDelete
  17. >Secondly, even in web applications you'll run
    >into problems the second you start implementing
    >anything more taxing than a web form. How does
    >the interpreter/compiler know which underlying
    >type to use? You'll be wanting to use IEEE-754
    >for geometric calculations. But totally
    >inadequate for financial calculations.

    How does the interpreter know? Good question. Maybe you should ask the the makers of Python. Or Ruby. Lisp? Javascript? They all do at least a reasonable job of determining floating point vs. integers on the fly, and extending them if the range isn't big enough. Financial calculations work just fine when you work in the smallest denomination (i.e. cents in the US) and let the interpreter choose integers.

    Why use a "range of types providing abstractions over sections of the number line" when you can have "one type providing an abstraction over sections of the number line"? The interpreter is usually as good as you at figuring out what type to use, but why do unnecessary work that it can do faster?

    When you've written tens of thousands of lines each in languages with different features (I claim Java, Python, Javascript, C++, and Ruby), you'll have a much better appreciation for which languages are better.

    ReplyDelete
  18. > Aaron Dufour said...

    You say like if types were non-existent in Python/Ruby/Lisp... Objects in these languages are STRONGLY TYPED and only references to objects are untyped. In Python you can do int(22), float(22), Decimal(22) if you want to use specific number type.

    And about the "Hate Java" debate, IMO:
    - Java is a GOOD language for corporations where big systems are developed by many non-devoted programmers, possibly outsourced
    - Java is a good language when high performance is needed
    - The language is good but the "enterprise" technologies: Spring, Hibernate, JEE are absurdly complex and yet they resolve very few real problems
    - Java is a VERY BAD choice for startups/small teams of talented programmers. You can achieve enormous productivity gain when using Python/Ruby/Lisp in such setting.

    ReplyDelete
  19. "Hrm. Not quite a qualified statement.
    Google? C and python.
    Yahoo? PHP.
    Facebook? PHP.
    Amazon? C and Perl.
    Wikipedia? PHP."

    Let's look at reality a bit:
    Google: C++, Java, Python, Go, Ruby
    Yahoo: PHP, Java, C, Perl
    Facebook: PHP, Java, C, Python
    Amazon: Java, C, Perl, Python

    I'm not sure about what else Wikipedia does internally (I haven't worked there and don't know people who have), the others all use Java _heavily_. It's the primary language at many of them (even if the front end looks like something else) and the main secondary language at the rest of them. That's not to say it's the best/favorite/etc, but it is a major driving force in many companies.

    ReplyDelete
  20. As the author of the post, I'd like to thank everyone for the comments.

    I would like to address the people that don't think Java is currently dominating web applications: take a look at Java Application server sales from IBM, Oracle, et all. It might not be dominating language at Facebook, MySpace, or your other favorite web2.0 site, but the fact is the US Government and the traditional enterprise is heavily invested in JEE/J2EE. Microsoft technologies are second, then there is quite a wide margin and PHP begins to appear.

    This emphasizes the main point of the article: You've forgotten common technology around you isn't written in an exciting language. While the Ruby, Python, Lua, Scala cloud is fighting to be a the next Java, I think the real point is we should focus on who can do better than Java.

    ReplyDelete
  21. Its interesting to see that you make the case using COBOL and mainframes as example. From my experience, a lot of stuff that used to be COBOL is now written in Java, and I personally think that *eventually* Java will replace it (unfortunately).

    The amount of legacy code being written in Java today is enormous, and it is written by lousy programmers focusing on adding cool frameworks and design patterns. And as a result of that, and from what I have seen (in Banking, public organizations) the Java code produced today in those places is extremely bad and horrendously over-engineered and complex.

    So in short, I think Java is currently becoming the COBOL of the future.

    ReplyDelete
  22. I'm not a big fan of Java, but I love the JVM.

    I dabbled in Ruby for a while before discovering the Grails web framework and the Groovy language. Absolutely love them. They combine to provide the power of Java with the productivity and ease of use of Ruby/rails, plus they integrate seamlessly into the Java ecosystem (jars, war files, etc.).

    ReplyDelete
  23. Here's my plus and minus list for Java:

    - The Java language lacks certain features common in other languages.
    - The language is kind of verbose.
    - Certain conventions in the Java world, such as java beans, are unfortunate
    - Some language features introduced in 1.4 and onwards are rather limited and have created more problems than they solve.

    + the JVM is pretty much the best in class in what it does.
    + The amount of functionality available as open source (or even in the base platform) is enormous and generally much more mature than what you'd find in competing platforms. Using something else than Java can feel like an exercise in wheel reinvention
    + Other languages can be made to run on the JVM than Java. I'm aware of python, ruby, javascript and most of the other 'NoJava' poster childs running quite well on the JVM.
    + There are a few interesting languages emerging that are primarily targeting the JVM. These include Mirah, Scala and Clojure. Other than Go, this segment of the market (compiled languages) is rather poorly covered outside the JVM.
    + The amount of tooling specific to Java is essentially unmatched in any other language. If you can do without e.g. refactoring, quick fixing IDEs, elaborate debugging support, profiling, etc.: be my guest. Mostly this tooling is either appallingly primitive or non existent in other languages. Other languages than Java tend to be second rate citizens in most IDEs, which at this time are mostly Java based.

    ReplyDelete
  24. SAP is written in Cobol. Actually a proprietary dialect of Cobol called "ABAP" that is actually said to be even less pleasant to use.

    SAP is a massive piece of shit. I'm not exagerating; it's THAT bad. Its user interface is a WTF of gigantic proportions. Got a 30" monitor? Good for you, but the polished turd that is the SAP GUI will stick to its 80x25 mainframe, screen-oriented terminal roots, fuck you very much.

    Oh look, an helpful inline help button! Forget about it, 99% of the time, it only contains a title (typically, the name of the screen you came from), and one unhelpful line, or worse, an obscure numerical reference to an error code or something.

    And 1% of the time they will explain you such advanced concept on how to use that newfangled gizmo called a "mouse" or "keyboard," or that level of helpfulness.

    I have been known to complain about enterprisey software. Now I have to use SAP to input timesheets ("CATS"), and I'm shutting up. It's just that bad.

    ReplyDelete
  25. I switched my job a year or two ago to a Rails shop for a number of reasons non-programming related.

    Rails is the worst.

    You know some of the reasons I love Java (and this extends to other languages too - but I am mainly speaking in a Java vs. Ruby paradigm):
    - Code completion - I work in X different languages a day (HTML, JS, SQL, etc., etc.) - not having to task switch to reference docs is a godsend. In ruby/rails - every time I need to splice a string (example) - I have to open a browser and hunt for it - it absolutely destroys my productivity. In Java I can bang out an entire controller, class, jsp without ever leaving the editor to remember syntax or reference documentation on what is deprecated what isn't and that is a godsend.
    - Code coverage tools - one exists for ruby/rails but isn't very good
    - Documentation - Java is amazing. For example google "Rails/Java database connection pooling" and compare the quality of the results
    - Ability to use the editor to drill down into methods or determine source of calls. In Rails the worst thing ever is a variable in your controller, and you have no clue where it came from or even what data type it is... then you have to go track it down however you can (manually finding and opening up the parent classes til you locate it). I long for the days where in Eclipse you can right click on a method and find every other method that calls it and do automatic refactoring.

    I could go on for days.

    The one thing that Rails does do that I really enjoy is database migrations being coupled with a build. I have always contended that for the majority of Java web applications, the database structure is tied to the code and should be treated as part of the deployment - Rails makes this assertion from the beginning which is nice.

    For anyone reading this and evaluating Java vs Rails for some project, this is the analogy I like to use:
    Its like if you were playing football. Rails will get you to the 20 yard line of your project almost immediately, while Java will be slower to get that same amount of functionality. By the time you get to the 40 yard line they will be neck and neck and Java will pull away. Rails will never make the touch down with any quality.

    If it is a project that needs any longevity (longer than 6 months) - the refactoring capabilities of Java will keep your project from turning to crap, while Rails will turn into fragile spaghetti code.

    ReplyDelete
  26. @DamballaWedo
    "its obvious that OOP and design patterns have failed to deliver any of its promises"

    I really do not get why you added Design Patterns into your argument.
    Design Patterns are used extensively in "trendy languages" web frameworks.
    MVC is the entire basis of RoR, DJango, etc!

    Design Patterns HAVE delivered on their promises of creating a common vocabulary for architectural design of programs allowing teams with programmers of differing skills and abilities to communicate more effectively.

    And perhaps you should take a look under the hood of RoR or Django to see all of the OOP at work there.

    There seems to be a lot of misdirected anger at OOP and DesignPatterns that should be directed at poorly implemented libraries/frameworks and missing/faulty core language features.

    ReplyDelete
  27. You miss the main point for selling Java: It is MUCH MORE THAN A PROGRAMMING LANGUAGE.

    I remember the marketing speeches Sun/Netcape/Novell did back in the Java 1.x days, that has stuck with me since then (but sadly were not repeated enough as of late):

    JAVA IS A TRIDENT, IT IS:

    1. A virtual machine
    2. A Software ecosystem
    3. (and only last) also a programming language.

    I can write Java apps that run on any OS, from embedded to cell phones, to web servers to Linux/Unix/OSX desktops, using a plethora of languages, as long as I can run these on top of Java.

    Case in point: JRuby, Jython, Scala, or the newly open sourced NetRexx.

    http://ho.io/nrexx1
    http://ho.io/nrexx2

    I´d add a new, fourth point:
    4. Java is GPL Free Software.

    It´s main competitors, are propietary, from Microsoft´s .Net, to Silverlight. (Novell is going down the drain and its .Net clone Mono faces an uncertain future after being spun off).

    And even Microsoft seems to be de-emphasizing .Net for its win8 UI... speak of a hard sale of its own tech!

    http://blogs.computerworld.com/18417/windows_8_developers_silverlight_net_xaml_are_m_i_a_m_i_a_m_i_a?af

    So, in a nutshell, the future of Java -with OpenJDK- looks brighter than ever.

    FC

    ReplyDelete
  28. Java the language is a hopeless mess of bloat and straightjackets.

    It will never anything else.

    That is why Scala, Clojure and JRuby are so important to keep Java the platform from being just a platform for legacy code. Of course your average Java API monkey won't be to look outside the box to learn these amazing languages.

    ReplyDelete
  29. don't stick C in this. java is horrible, it has to die.

    ReplyDelete

Related Posts Plugin for WordPress, Blogger...