What is the best language is better left for an academic discussion. Reality rarely favors the “best” anyway, because “best” is a very subjective term, ask an engineer and a businessmen what is the “best” programming language, the engineer will answer “The best designed language”, the businessman will answer “The one that creates most value for me/my customers as cost effective as possible”. Sadly, there’s little correlation between a well designed language and productivity.
So far, all the con points here about javascript are exactly that, “it’s shit”, a very subjective thinking from an engineering standpoint.
Windows 95 crashed every day back in the day, it didn’t stop it from becoming the most popular OS in the world, because no matter how often it crashed it was always many times more productive than the alternative.
Which language will be used a lot (does not mean “used exclusively”) in the future, the trend favors Javascript (among others), but not so much Java.
It’s already falling out of fashion to have JVM’s installed on the desktop side, Applets are disabled by browsers by default, difficult to find devices that support Java. On the server end, Java still has a fighting chance, but I don’t it will be for long, new languages that scale better are already eroding Java’s base there. That’s the trend for Java, and you don’t need to be a javascript lover to see that.
Just recently I found out how horrible Java is doing multiple asynchronous calls (deferreds) in the backend. I had to fix this code someone had written, he wanted to do multiple asynchronous calls, and he ended up creating one thread for every call he made, or roughly 100 threads, PER CLIENT REQUEST. Of course this was rectified with a thread pool and executors, but even with that it was nightmarish, because we had to somehow manage the executor service for that particular controller, and that added to the complexity and counter-productiveness.
This was no junior programmer who made this mistake, and he writes java all day long. Why seasoned java programmer stumble on this is self-explanatory, the language doesn’t promote doing complex things in a instinct-like, easy, productive manner. Given how “well” java is designed, the language constructs just don’t scale for the modern reality of mass-core servers and asynchronicity. Compare it to javascript and how easy it is do use jquery’s $.when().
XML is falling out of favor too, and JSON seems to be the programmers choice nowadays. Ever tried reading JSON data with Java? Well, it’s a mess because Java is strong-typed. XML is no better in Java. Javascript and JSON is a happy marriage.
But there’s so much happening on the front-end, with all the devices, and in the back-end, that if you truly believe Java is the way to go (full steam ahead) then you’re in for a surprise when in 5-10 years junior programmers will not work on your projects because it’s java.