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#. ;-)

Saturday, February 2, 2013

VirtualBox with Linux guest on Windows host won't resize after installing guest additions

Before I go on a rant, here's the short answer:

Instructions from the VirtualBox manual say to install Dynamic Kernal Module System (DKMS). For my Ubuntu setup this is what worked:

sudo apt-get install dkms

For a Fedora installation it's something like this:

yum install dkms

Follow these instructions for detailed steps on Suse, CentOS, Debian, etc.
Now that DKMS is installed, you can (re)install Guest Additions. They say to install DKMS before installing Guest Additions, so if your Guest Additions are already installed and functional (ha! If they were, why would you be reading this?) you might consider a) uninstalling and rebooting; or b) just rebooting because if you had the same problem as me the reboot breaks Guest Additions anyways.

Back to my rant...

Wow, how's that for a link-bait title? And why such an obvious bait for the search engines? BECAUSE IT TOOK FOREVER TO FIND THE ANSWER. I've dealt with this issue for several months now by simply not rebooting unless it was absolutely necessary. Once a single reboot was done, my screen was stuck back at the smaller resolution that my image started at.

I would have thought that since my Ubuntu image came from VirtualBoxes.org it would play nicely with Guest Additions. Apparently those images are fairly stripped down with only what's necessary. Since those are "additions", the prerequisites aren't in place.
Don't you just love those little nuanced rat-holes you encounter as you learn? Blarg.