

Ask HN: Is JavaScript Java.next()? - rkalla

Like you all I digest the daily collection of JavaScript-created genius on HN with a little bit of "god I hope I don't need to learn how to do that..." and a whole lot of open-mouthed gawking.<p>Some JavaScript trends in the last few weeks that I didn't know was possible:<p><pre><code>  PDF Rendering [1]
  MP3 Decoding / Playback [9]
  Parsing/Rendering RAGE Game Levels [2][3]
  Parsing EXIF Data from JPG/TIFF Images [4]
  Physics Simulations [11]
  Animated/Interactive Insanity (Thanks Ben Vanik!) [5]
  Servers! (Nodejs) [6]
  Video Games [7]
</code></pre>
Why isn't any of this being done at the same scale and fervor with Flash? Why not Java Applets? JavaFX? Air? Silverlight?<p>JavaScript seems to have something going for it that only Java before it had: a VM arms race involving all the major tech companies in the industry.<p>The first 4-7 years of Java's life was punctuated by almost yearly (notable) performance jumps as Sun, IBM and BEA battled each other for the VM crown (Microsoft bowed out early after the lawsuit so I won't include them). I remember the pre-1.4 days as relatively blasphemous to use Java on the server side; it was too "slow and bloated" for a large-data application (although IIRC eBay was one of the first large-scale commercial rollouts of Java).<p>Post-1.4, into the 1.5/5.0 and 6.0 days it became a forgone conclusion for a lot of folks that Java was just what you used on the server[8].<p>That shift and acceptance caught me off guard at the time, but I see that as a direct function of the performance increase in Java (and server hardware) suddenly allowing the convenience of using Java to be a reality with less and less cost associated with it.<p>That seems to be exactly what is going on now with Google, Apple, Mozilla and Microsoft. I imagine some of these companies (Microsoft?) would have preferred staying out of the VM wars, but find themselves committed[10] because of how fast the tech is advancing.<p>Look at what JavaScript was doing 4 years ago compared to those links I posted above and it's night-and-day; more of a leap than Java ever took and I don't see the trend slowing.<p>I've been curious for 4 years or so what Java.next() would be.<p>Ruby has got it's following and GO will most certainly have it's group of supporters grow in the next few years as the language matures, but none of these languages had what it took to actually knock Java off its "I do everything pretty well on most all platforms!" pedestal until JavaScript sauntered in the room and every hacker with a wild hair decided to do things I thought were impossible with it.<p>To recap, why I see JavaScript as Java.next():<p><pre><code>  - Platform independence (Desktop, Server, Mobile, etc.)
  - VM Arms Race / Investment from 4 mega corps
  - Java-esque feel to it, making it an easier transition
  - Big existing code base of libraries and examples
</code></pre>
Do you all see the same writing-on-the-wall that I do or have I just convinced myself it is there?<p>[1] http://blog.mozilla.com/cjones/2011/07/03/pdf-js-first-milestone/<p>[2] http://blog.tojicode.com/2011/05/webgl-rage-source-is-up.html<p>[3] http://www.youtube.com/watch?v=d0S2dsuSxHw<p>[4] http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html<p>[5] http://www.ro.me/<p>[6] http://nodejs.org/<p>[7] http://www.webresourcesdepot.com/25-amazing-javascript-games-some-fun-and-inspiration/<p>[8] http://www.infoq.com/articles/twitter-java-use<p>[9] http://jsmad.org/<p>[10] http://mashable.com/2010/10/29/microsoft-silverlgiht-html/<p>[11] http://www.queness.com/post/3296/8-amazing-javascript-experiments-of-physic-and-gravity-simulation
======
mahmud
Java is Java.next();

I jumped on the java bandwagon a few months ago, but fully committed to it for
work just in the last month (long story, sole/lead/CTO for fashion house with
tens of retail outlets. Ass needed to be covered, and we're doing 30% Android,
so might as well go fully java.)

Yeah, it's doable. In fact, it's tasty. Eclipse integrates really well with
it. Java EE is better than I expected: I would kill to have hibernate/JPA for
Lisp, to be honest. I tried a few web frameworks but decided to use Play,
which is absolutely delicious.

If you have any substantial "backend development" you will cream your pants at
how much "process" & good workflow the Java ecosystem embodies. Right click ->
Run As -> Deploy on Server. There ya go, then you get a bunch consoles to
monitor your apps and get some fine grained stats. You can hook a debugger to
remote process, if you need that too.

I implemented RBAC security, database auditing & roll-back (at the ORM level,
zero SQL), object validation, the whole admin crud, and a REST API in 2-3
weeks. Having never done it in Java before.

Dependency injection is one of those opaque jargons that don't make any sense
until you do a bit of Java. Then it's the most awesome thing you ever heard
of.

Modern Java is not like the Java of old. It's all clean classes, a few
conventions (yes, they discovered "convention over configuration" and the
annotations make everything a breeze), and the rest are just rock solid
servers and software.

I can safely say that XML is 100% optional. I have yet to write any of it.
Nearly everything is done with var=val type configuration files.

Once you get the hang of it you discover you have a world of possibilities.
I'm pretty much spoiled for choices.

Not necessarily "fun" and "hackish", but it's very productive (it doesn't
_feel_ like normal coding, more like assembling blocks. 90% of what I do is
customization. As a matter of fact, I prototype all of it in Common Lisp
before I rewrote it in Java, so I might be in for some pain later, who knows.)

~~~
revorad
What are your thoughts on Clojure? Do you use it?

~~~
mahmud
I think clojure is lovely, but my current circumstances are such that I can't
be selfish. I have no "technical" supperior, I'm the "it" guy at work, the
sole arbiter of everything software, and the trust placed upon me is far too
great for me to take lightly. So I decided to man up & do everything as
formally as possible: for my employer, for the responsibility, and for my own
sanity should I decide to walk away.

------
nxn
Because using javascript is convenient and fits well in an environment of
"just type in a URL and you're good to go"; your users wont have to install
anything, you'll be able to make updates EVERYONE will get the next type they
visit, and you're not limiting yourself to a fraction of the people who have
an up to date version of some plugin. To me that's seriously about the most
perfect app deployment mechanism I could want. At least on the web it is.

I personally still wouldn't use node.js ever, but I see how it might be used
by someone who already knows javascript and doesn't have the time to pick up
Haskell or Erlang for some idea they want to execute.

Also, it used to be that without the HTML5 tech a lot of what you listed
wasn't even possible and that was a forcing factor to use something else. So
it's not just improvements in speed here, that RAGE demo wouldn't exist
without WebGL.

~~~
rkalla
Other excellent points; I hadn't even considered the deployment/update
scenario and how many different ways that problem has been solved and re-
solved in different languages to just try and make it easier (Installshield,
OSGI/Eclipse Update, Flash, WebStart, Windows Installer, etc. all come to
mind).

------
Meai
If we get an IDE with proper intellisense going and performance comparable to
Java and C were indeed possible. Personally, I just don't think a dynamic
language is ever going to get large scale adoption like Java/C/C++. It's just
too inconvenient to test.

I actually think C is going to have a comeback, as crazy as that sounds right
now.

------
Apocryphon
What's the JS equivalent to J2EE?

~~~
CyberFonic
Why would you want one?

For me J2EE is the very reason I abandoned Java. Lean and mean is the win for
me. Unfortunately, I can see that given time NodeJS will accumulate all the
"enterprise features" to make it the behemoth of its day.

~~~
threepointone
I've actually heard Ryan Dahl (who made node.js) say specifically that he's
against node becoming Java-like. I'd take his word for it :)

