2010-10-26

Java, don't make long term plans

I have been using Java as my main programming language for about 7 years now.  Before that I had used Java for hobby projects since its first release some time in the 1990s.  The reason I switched from programming mostly C on UNIX to mostly Java in 2003 was the availability of asynchronous network APIs and a reasonably performant JVM.  It also didn't hurt that Java is still the only language I can think of with decently designed collection classes.  Later in 1.5 Doug Lea's cocurrency library also made it into the class library, which of course was nice.

These days a lot of things are conspiring against Java.  The most obvious threat to Java is its new owners:  Oracle.  It is becoming ever more clear that the Java community as a whole would be better off if Oracle had not bought Sun.

When Oracle took over Sun I have to admit that I was mildly optimistic.   Sun was perhaps one of the more promising companies from a technology point of view.  But it doesn't help being "promising" when you are coming of age and you have not made it out of your mother's basement.  Under competent management Sun would have leveraged its strengths and been the leading star in the cloud computing era.  Instead companies such as that book-shop from Seattle are leading the way.

Sun's slogan used to be "The network is the computer", but what they lived was "the computer is the computer and it is an expensive computer very few people would want".  Meanwhile they managed to realize exactly nothing in terms of being "the networked computing company".  Funny that.

I was mildly optimistic because I thought that Oracle might provide the much needed leadership to make something of Sun.  Unfortunately it turned out that not only are Oracle mostly concerned with shortsighted money-grabbing by hitting up Google for spare change, but they appear to be really terrible stewards of the Java community.

The one thing Java had going for it was a strong community -- bordering on the fanaticism usually associated with Apple technologies and products.  That community is very confused these days.   People are essentially asking themselves "is it over?".  With some regularity Java luminaries are jumping ship.   Just a few days ago Doug Lea announced he was not seeking another term on the JCP Executive Comittee.  Before him, Gosling and others left Oracle.

It probably isn't "over".  Likewise it sure as hell isn't "promising" anymore.

I am not sure if Apple decided to no longer ship their OS with Java pre-installed because of Oracle.  Steve Jobs and Larry Ellison are apparently personal friends, so I suspect this may be a dig at Google, since Android is in fierce competition with iPhone.  Jobs' friendship with Ellison and Oracle suing Google for the only successful use of Java on mobiles makes this a complex question.

Yes, I know that Dalvik is not a JVM, but to developers it doesn't make much of a difference.  Yes, I also know that J2ME is probably on more phones than Android, but I said successful.  J2ME has always been a piece of rubbish and I can not imagine that it will stop being a piece of rubbish any time soon.

An interesting side-note:  the percentage of Java developers using Macbooks at conferences is disproportionally high compared to the market share of Macbooks.  While desktop Java apps are not that interesting to me, it will be interesting to see what effect this will have on people who serve as key technology influencers -- ie developers and geeks.

In the short term I will still rely on Java as my main programming language,  but I think there is reason to be concerned about the future of Java and to start looking for alternatives.  With Oracle's non-stewardship of Java I would not make any long term bets in favor of Java.

Sure, Oracle may mend their ways, but Ellison doesn't strike me as the kind of guy who apologizes for behaving like a sugar crazed five year old.  The guy lives in a replica samurai village, runs a company that "doesn't do employee appreciation events" yet has no problem setting fire to a metric fuck-ton of cash to fund his fondness for wind-propelled maritime toys.  Java is his toy now and if he wants his lawyers and miscellaneous suits to use it as a slugger to hit his competitors over the head, then that is what will happen.

The safe bet is to start noting where the exits are.

Before we go on:  forking Java is not really an option.  We will end up with lots of incompatibilities and any target big enough to register on Oracle's radar will come under fire by hordes of patent lawyers and assorted Oracle trolls.  Don't go there.  Forking is not a long term solution.

One such exit may be Erlang.  What little I have managed to learn about the language seems very promising.  Now that CPU clock speeds have long since stopped being a scaling factor for performance, languages that have been inherently designed for concurrency become more important to utilize all those cores.  I have to admit that I still know too little about any potential legal pitfalls that may or may not be associated with Erlang, but if there are any:  now is the chance to learn from the Java adventure and make Erlang a safe bet.

I hope to get enough spare time to learn Erlang soon.  Or better yet, if someone is willing to pay me to learn Erlang while building something in it.

I see .Net as a non-option.  I have never had much faith in the Mono project and the .Net platform is always going to be intrinsically linked to Windows -- and Windows is the odd one out as far as operating systems are concerned.  It is the last of the ancient, weirdo, oddball operating systems.  The rest of the world is UNIX.

For those of you pushing PHP, Ruby, Python, Perl and miscellaneous scripting languages:  no I am not going to bother explaining to you why these are not replacements for Java and the JVM.

Groovy, Scala and other JVM-bound languages also are not an option for more obvious reasons.

C++ and Objective-C are also not an option.  I view these as by-products of the adolescence of OOP that should have been discarded as their use-by date expired,  but which have unfortunately stuck with us like a bad smell since the days when the mullet was considered the epitome of cool.

And C?  Be serious.

25 comments:

  1. In most cases, if you learn Erlang u won't look back :)

    ReplyDelete
  2. Python is the way to go: no I am not going to bother explaining to you why it is the replacement for Java and the JVM.

    ReplyDelete
  3. Erlang? Erlang handles things in an entirely different way to Java. It will simply blow the minds of most Java developers. Even if/else constructs are radically different (you can generally write entire programs without using even one if/else statement). Not to mention that Java is about writing incredibly verbose classes and accepting deep levels of responsibility when it comes to handling errors, while Erlang is terse and is designed to fail immediately.

    Erlang is a fantastic language, if what you want to do is pass messages around a tonne of computers.

    ReplyDelete
  4. The Browser IS the client side platform for the next 10 years. Javascript is it's language.

    Use Rhino for Javascript build scripts.
    Use Rhino for Javascript on any Java based server.
    Use JSON for meta data files and client server communications.

    The Browser IS the platform and Javascript is the language.

    ReplyDelete
  5. Erlang? You are a Java guy. You ship products. Right? Erlang? I just lost all respect for you mate. Cool. Sure. And next week all the LISP and Smalltalk weenies will switch from Erlang to NextCoolThing. But meanwhile, if you're writing an app that is going to be big and used by millions of people, it's going to be in C#, or C++, or C, or Objective-C, or Java.


    Erlang. Ha.

    Warren

    ReplyDelete
    Replies
    1. You think in terms of immediate options. I think in terms of directions we should be moving in. This is why your way of thinking doesn't lead anywhere and why you seem to have missed completely the resurgence of JavaScript.

      While Erlang is still a bit of a pony-tail environment today, this class of language offers a lot that is more suited for how computing platforms are evolving than languages that look backwards.

      Java is, at heart, a philosophy that suits single-tasking. While it offers primitives languages like C++ doesn't have and it has an increasing arsenal of library support, concurrency comes at a cost. Not least because it has to be accessible for people who do not understand concurrency. It is marginally easier to write concurrent code in Java than in C. (And I spent more than a decade and a half writing C under UNIX that mixes multithreading, asynchronous processing, event models etc in ways that it would take Java a decade to catch up to).

      Delete
  6. Warren: I've been working with Erlang for 20 years and been shipping products for half of those years. Products, that runs 24x7 (i.e no bloody downtime at all) and withstands an incredible load. Go and read up!

    ReplyDelete
  7. Three words: Scala on Mono.

    ReplyDelete
    Replies
    1. Oddball semi-functional language with terrible tool support and a dog slow compiler on top of marginal runtime project by a fellow known to just randomly abandon projects? Oh yeah, that gives me a real good feeling :-).

      Delete
  8. Hey Tobbe, don't feed the trolls buddy :) Let Warran choke on water from the mainstream and you just carry on making great stuff using a language/platform that is extremely underrated.

    +1 for Erlang. I'm sure you'd hear the same from the creators of CouchDB, Riak, ejabberd, and more. It's a great tech with astounding capabilities.

    ReplyDelete
  9. I like the diversity of the comments better then the narrow mindedness of the article. They should provide some peace of mind.

    ReplyDelete
  10. Every language has its own virtues and defects, and every language is good for certain tasks. Everyone choose according to his own preferences and needs. We must respect the choice of the others.

    Like you, I've learned and used Java since the first releases, in the middle of 90s, when no company risked their money on Java projects due to its honeycombs. When Oracle bought Sun, my suspects were very negative, because I worked with Oracle products in the past, and I don't like the monopoly politics and the closed mind of Larry Ellison.

    Since 2000, I worked in projects with .NET, and I like this technology, because is constantly innovating and have an a great community, with a mind between the open (majority) and closed (minority) software, with a great variety of ideas and good projects. Technologically, the languages and the technology of .NET platform is advanced, and is comparable to Java. It's not a joke.

    Although, I love the open source, and the last years I was dedicated to experiment with some free languages. After so many tests, I'm betting for Flex (RIA's), Python and Ruby. The reasons? The madurity of these languages, the great community around them, the multi-platform feature, the great amount of projects (frameworks, drivers, libraries, etc.), the documentation, the information resources, the forums, etc.

    My poor experience with Erlang (through CouchDB) isn't enough to valuate this language. In Spain, we don't know any project with this language, and no jobs related with Erlang is available. You also must think in the possibilities of the language in order to work in the real life, not in your spare time, like a hobby.

    ReplyDelete
    Replies
    1. So you judge Erlang on the basis of one product written in it? Really?

      There are lots of great products implemented in C++. C++ is still a pretty horrible language to work in.

      There are lots of bad products implemented in Java. I'd still prefer Java over C++ because for general purpose programming I am able to be more productive in Java than in C++.

      Also, if you want to compare Java and Erlang you have to compare it to what Java was before Java was mainstream. Erlang has not hit the mainstream yet (and probably never will, since that takes a level of pragmatism that would be uncharacteristic of people who like functional languages and lisps)

      Delete
  11. Rafael: a little hint: tuenti.es

    ReplyDelete
  12. Honestly I feel Java has been on life support for some time. It's fundamental language structure means that additions like closures are only ever going to be a less than happy compromise. Surely, no one really wants to try and argue that generics are just perfect do they (you've seen the consequences of type erasure and the impact on reflection APIs, right)?

    So, let's assume for a second that extending the language isn't worth doing and that other languages can pick up that slack e.g. Scala or Clojure.

    That leaves the need to "standardise" APIs - well if we actually think that's necessary. How many of us actually use standard libraries all the time? Don't we all have extras on our classpaths? And what's the big deal if they're not bundled with the JVM? One might even suggest that we've gone way too far down the bundling path and that we should stop. There's always more we could add but is it worth the pain?

    And that leaves us with the JVM - it provides a decent (runtime) compiler, access to graphics primitives, asynchronous I/O and such - enough to build most things these days. It's not perfect but it's maybe good enough.

    As to standards well they've been a double-edged sword - often hijacked by vendors or designed by cliques with insufficient external reference and a fair amount of selfishness leading to APIs that make your head hurt. Not too mention slower evolution because everyone prefers to argue in theory as opposed to test in practice.

    Okay so Java is as complete as it'll get and moving towards expiry, fine, maybe all we actually need is the JVM as it is now (albeit with more optimisation) and maybe keeping that ported to multiple platforms if we treat everything else (additional APIs etc) as non-standard is reasonably viable. At least in case of the Mac, the worst bit is the graphics integration which could and has been done in the past via X11 - again not perfect, but workable.

    Overall then, things aren't great right now with the level of uncertainty over what if anything Apple will do to foster a community effort on JDK for OS X but maybe it's not so bad ultimately if we perhaps let go a little bit of trying to standardise and bundle everything.

    ReplyDelete
  13. I would agree that right now Erlang doesn't look like much both in terms of market share and breadth in library support and suitability as a general purpose language. But to be honest, Java wasn't all that great in the beginning either. And it took a lot of convincing people to start to use it.

    Right now Erlang is somewhat of an oddball language because most people are used to languages with ALGOL ancestry and imperative programming styles. This is changing since single CPU core performance is not going to double every so many months.
    Of course, it takes time for the programmer workforce to develop the skills needed to adapt to the changed circumstances. But it is happening and over the next 10 years more young programmers will be mature and be proficient in the use of languages and programming styles more suited for heavily concurrent environments.

    I don't doubt that .Net is every bit as good as Java. Quite possibly better in some respects. But .Net is tied too closely to Microsoft and to Windows -- and I would hate to be dependent on an operating system that I am not fond of working with. I was not joking when I said that the rest of the universe has gone UNIX. It has. And for good reason. Yes, I know about Mono, but Mono is always going to be playing second fiddle as long as .Net is a marketing vehicle for Windows.

    That being said, I think Brodwall's suggestion of Scala on Mono sounds tempting, but .Net is a Windows technology first and foremost.

    As the comments illustrate: most people don't want to learn a new way of thinking or even a new language. This is understandable. Learning a new language is a big investment of time and effort. Learning a new way of thinking is an even bigger commitment. It took close to 25 years for people to make sense of OOP and for OOP to evolve to the programming styles good practitioners use today. Making sense of heavily concurrent programming influenced by functional styles might take just as long, though I doubt it since developers now have more direct access to more knowledge and people through the net.

    (I should probably mention that I do not write desktop applications. I mostly develop server-side systems. Erlang is already well suited for these types of software. I don't doubt that it has a long way to go to be a suitable environment for desktop apps, but that doesn't mean it can't or won't)

    ReplyDelete
  14. What about Flash? It was on it's way out but this could only work in it's favor.

    ReplyDelete
  15. Flash has quite possibly the worst runtime of any present-day product and is a hack to fill the gap of the disappointment that was applets. Applets being the least interesting use of Java ever and the most horribly hobbled artifact of Java.

    ReplyDelete
  16. I've got a bag full of ('s and )'s right here with your name on it Bjorn. :-)

    Seriously, Erlang is an interesting language and fun to use. I don't see any reason why it can't power the back-end of pretty much anything.

    I also actually like Objective-C -- at least the language part, even if C makes me swear and curse most of the time.

    ReplyDelete
  17. Crumbs, just read through the first couple of chapters of the Erlang reference, what a convoluted language. For those who don't know it, it's a cross between LISP and python. It's a real testament to creating job security! Say what you like about Java but at the end of the day the learning curve is quite shallow, which makes for easy adoption.

    I agree with the spirit of the article and having been on the receiving end of Oracle's atrocious Metalink support web site, I think that Java has enough community to pull it through this difficult period. These days most Computer Science degrees (in the UK) only teach Java so we will be generating Java/OO programmers for the next couple of years. They will all need somewhere to work reducing the cost of Java development further, making it even more attractive.

    ReplyDelete
  18. Java and to some degree .Net are the main choices because they have been consistently pegged as the “safe” choice to go with for mid-level project managers in the corporate world. No one was ever fired for choosing Java or Microsoft.

    However, there are many large distributed applications these days that run primarily with technologies like Python, PHP, et al. Even companies like Google and Yahoo are heavily invested in these technologies. Java may be the main choice for enterprise development now, but it’s days are numbered as the only stalwart option to go with.

    Let’s face it, many of these so called “enterprise applications” could easily have been written much faster and with less overhead using technologies like Python, PHP, et al.

    ReplyDelete
  19. Jazzie: I happen to have worked for both Google and Yahoo. I also happened to be one of the first adopters of PHP back in the 1990s when it was called PHP/FI. (I even contributed some minor stuff to PHP back in the day).

    While Yahoo had PHP systems when I left, I've never seen a single PHP frontend at Google. If any exist I at all I sure never heard of them. So I wouldn't exactly say that Google is heavily invested in PHP. Most engineers at Google would be offended if you suggested they use PHP.

    As for Python: well, Google App Engine was a heavy user of Python and probably still is. There are bits and pieces of Python here and there, but App Engine is the only major system written in Python at Google that I can remember. I may be wrong though.
    Google famously used a lot of Python in the past for the search engine (long before I joined). Today in the search engine: not so much. They use C++. Actually, Python is a bit of an outcast. If you want your project to be taken seriously within Google you had better stick to C++ or Java. Google has a very strong C++ culture.

    I think it is fair to say that Python is probably the third most important language at Google. After C++ and Java.

    I stopped using PHP almost a decade ago. It isn't really suitable for developing anything but relatively trivial systems. The language is a mess and the community is full of people who know very little about software engineering or even basic programming. Of course that doesn't mean people don't try. Lots and lots of important but bad software is written in PHP. Mediawiki and PhpBB are probably the most common systems. And they pretty much suck if you want to hack on them.

    As a language and an runtime system PHP can't really be compared to Java or .Net and it would be offensive to a competent software engineer to suggest otherwise. Seriously.

    While Python is a nice scripting language, it is just that: a scripting language. It isn't really suitable for building anything that compares to the JVM or the CLR. If you want to understand why I suggest you get an education or you educate yourself on the topic. A bit of reading never hurt anyone.

    People are entitled to their opinions, but when they in all seriousness say that PHP and Python are replacements for Java they are mostly outing themselves as clueless. And I am not saying that to be mean.

    ReplyDelete
  20. Erlang? There must be some other language you don't know anything about.

    ReplyDelete
  21. If you have read a bit of Erlang and concluded that it is "a bit of Lisp and Python" then you need to finish the book before you open your trap again.

    ReplyDelete
  22. Nice post, I pretty much agree with all of it. Oracle will most likely do the same thing to Java that they've done to every other product that wasn't their flagship database (i.e. let tie-wearing mgmt drive it into the ground). I've looked at Clojure a bit, I like the concept of how it respects the changing of identities over time to support easier multithreading (necessary for any language of the future). But none of these newfangled languages really seem to jump out of the screen at me like Java did circa early 1990's. For now, I think I'll be sticking with old reliable, very cross-platform Java, perhaps using more immutable classes and fighting the perhaps losing battle of trying to make thread-safe code. Its not perfect but still the best thing out there by far. For now at least. For UI coding, there is always GWT which provides a nice layer of isolation from the terrible, type-unsafe world of JS, plus GWT gives me the ability to share some source with the server.

    ReplyDelete