Friday, February 22, 2013

Is Java Dead? What language should you learn?


The Question

The son of a friend of mine recently asked what programming language he should learn. He heard Java was dead, but was confused because Android and iPhones use Java and they're more popular than ever. What's going on here??

My Response

First, iOS apps are written in Objective C, not Java. But that's just nit-picking. ;-)

The short version:

Programming languages are tools. Some are better at specific tasks than others-- you don't use a hammer to chop down a tree. Sure it'll work, but it's a lot of work and your end result won't be very pretty.

The long version:

Java is as dead as you want it to be, really. We've come into an era where there are lots of programming languages available, and Java is simply one voice in the choir. Each language is born with a specific task in mind. Over time that morphs, and some languages end up where they shouldn't be while others get pushed out of their established niches by something newer. Evolution, if you will.

Java was built to handle complex problems in a truly object-oriented way. Some languages work best as procedural (Assembly, C), others are functional (LISP, Erlang), and many are object-oriented. When Java came on the scene, people were tired of writing desktop applications in one language for Windows, another for Apple, and yet another for Unix/Linux. Manually allocating memory was (and still is!) a tedious and dangerous prospect. Java solved this problem by running in a "virtual machine" where the Java code would tell the machine what to do, and the machine did the operations on the computer it was running on.

The really neat thing was that around this time (mid '90s) web browsers as we know them were starting to appear. With the appropriate browser plug-in you could run the same app that you wrote for your desktop in the browser! Java and ActiveX (Microsoft) slogged it out in a death match until Internet Explorer 6 conquered the world... but the Pax Microsoft is another story for another day.

Fast-forward a few years. Desktop development is still a big thing, but web development is coming on like a freight train. Because Java was designed for complex problems, it has a natural home in large enterprises like medicine and online banking. For everyone putting up a website to show off their dog's new haircut, it's serious overkill.

PHP rules the land of small web projects. In part, this is because PHP is easier to learn, so lots of people pick it up. Look at that, PHP must be popular! But it turns out that it's not a very good language; just a very popular one. New versions and new frameworks come along  to make PHP better at large problems. But now it's not as easy, so a lot of people get turned off by it.

Enter Ruby. Ruby was an obscure little language until someone build the Rails web framework. One thing Ruby on Rails does well is handle the database for the developer. Up until now, you needed to create your database separately and then learn another language (SQL) to communicate with it. What a mess! But RoR makes that invisible. The programmer can just code, and Rails makes the database magically work.

By the way, by now the Java crowd has been doing that database trick for years, and they roll their eyes whenever the Ruby guys start bragging.

Now everyone's in on the game. Python has Pylons and Django, Microsoft moved to MVC, Ruby on Rails is maturing and getting better tools. Meanwhile JSP hasn't changed all that much because they had it right all along. Seriously, just ask them!

But now we're approaching an explosion of a different kind. Mobile computing and embedded devices are popping up in everything. What do they run? If it's really lightweight, maybe you need an embedded language like C++. Have a bit more horsepower? Java still runs on everything from mainframes to coffee pots. If you want to code on an Apple device you'll have to use Objective C.


So is Java dead? In short, no. It's a great general-purpose language that's just been crowded out of some niches by more specialized languages. That's just fine! There's lots of room for everybody, and good programmers commonly know at least one language in 3 or 4 different categories.

Where should you start? Pick a project (not a language) that interests you. Solve it in whatever's easiest to learn for now. Don't worry-- you won't get it right the first time anyways. The important thing is to start solving problems. When you encounter something that your current tool doesn't do well, you'll pick up another and be amazed at how much more productive you are. Keep working on interesting problems and pretty soon you'll have a belt full of useful and fun tools.




What do I use? Mostly C#. ;-)

2 comments:

  1. Over the past few months I've been hacking around with Rails, using Ruby for configuration management, PHP for a lead generation web site, Java for a CRM, and also pushed a Node.js app into production.

    I'd love to consolidate on one platform! But, as you said, chopping a tree down with a hammer doesn't make sense (always).

    ReplyDelete
  2. Hey! first of all I was kind of shocked when just saw this that java is dead. Being a learner I don't think so as Hello,I'm writing to ask a very basic question: anyone could give me some advices about the benefit of learning Java language.
    I've passed last year in exploring max and Jitter,
    and I've worked a lot on FFT and use of Jitter to handle FFT data. But I didn't dive to deeply in Jitter, because I'm not really interested in images. What I'd like to do is to have the possibility to make some operations on matrix based on Symmetry applications of Group Theory,
    In a way to modify the spectral informations held in the matrix. Someone could argue if this could be done in Max, or could be better to work on it learning JAva and programming specific Externals? For that I am trying to go for 6 week training http://www.wiziq.com/course/12145-the-6-week-complete-java-primer-with-training-certificate wonder this course
    will help me out
    Thanks.

    ReplyDelete