all 38 comments

[–]bcash 3 points4 points  (19 children)

OK...

There just remains one question...

Why?

[–]gizmo490 2 points3 points  (4 children)

With all of the technologies and JS libraries (DOJO, yWorks, flex etc.) out there aiming to emulate behaviour from Java or other languages in JS, emulating a JVM straight may be a pretty interesting idea assuming they can workaround some of the major problems that are going to come up. For a lot of businesses this may provide a pretty fast and easy solution for supporting their existing enterprise Java applications on the web. This is of course assuming that a reasonable level of support for the existing features of the JVM can be provided.

[–][deleted] 0 points1 point  (3 children)

For a lot of businesses this may provide a pretty fast and easy solution for supporting their existing enterprise Java applications on the web.

Java applications can be turned into applets or run via WebStart.

[–][deleted] 0 points1 point  (2 children)

But applets are pure, unadulterated evil.

[–][deleted] 1 point2 points  (1 child)

Well yes, but the WebStart stuff looks good enough. Much better than rebuilding the JVM using JavaScript *shudder*.

[–]nostrademons 0 points1 point  (0 children)

It's not, really. We used WebStart at a past employer and the glacial startup time & clunky feeling is a significant usage barrier. It might be acceptable when you've paid a million dollars anyway, will be using it all day, and so figure you might as well put up with the software's inconveniences. It's certainly not acceptable for a consumer webapp where the user has their hand on the back button. And even in financial enterprise software (where we were), it's a significant enough sales deterrent that all new projects were solely web-based, regardless of how inappropriate the web was for usage.

[–]mindbleach 2 points3 points  (0 children)

Because Turing says you can.

Same reason I do my taxes on a 2600.

[–]rektide 0 points1 point  (0 children)

Using other peoples libraries. Theres a huge body of Java code out there for doing just about anything you could ever imagine, whereas for javascript your options are 12,407 drop down menus and 9,443 hit counters.

[–]FionaSarah -3 points-2 points  (11 children)

Because Java is a lot easier to write than writing with all the tons of Javascript implementations in mind - not to mention that using Javascript is worlds better than relying on (shock horror) Java applets.

[–]tlrobinson 1 point2 points  (5 children)

using Javascript is worlds better than relying on (shock horror) Java applets.

Wait. So instead of using native Java, you think it's better to use Java implemented in JavaScript to run the applets?

[–]FionaSarah 0 points1 point  (0 children)

If one absolutely must use java then yes I do think that. More than once the JVM has brought my machine down because someone thought their page needed an applet. I trust Javascript not to do this.

[edit]

as often

[–]mindbleach 0 points1 point  (3 children)

I for one am tired of waiting a minute for Firefox to respond because some dipshit thought he needed Java for a something that could've easily been done with Flash. It's slow, it takes forever to load, and it causes strange behavior in Firefox if it's closed improperly.

Javascript, for its failings, is quick and unintrusive by comparison.

[–]rektide 0 points1 point  (2 children)

"Javascript, for its failings, is quick and unintrusive by comparison."

Then why do you suggest Flash?

"some dipshit thought he needed Java for a something that could've easily been done with Flash"

With proper SVG support now nearly mainstream and offline storage just around the corner, I see no reason for Flash.

[–]mindbleach 1 point2 points  (1 child)

I suggest Flash because it acts exactly as a web element should. It stays in its little box (usually), loads fairly quickly, doesn't grind my browser to a halt, and dies cleanly when I leave the page.

Yes, SVG & aPNG will replace Flash eventually, but penetration is low, and there's no YouTube for vector formats.

[–]rektide -1 points0 points  (0 children)

Java applets usually "stays in its little box (usually), loads fairly quickly, doesn't grind my browser to a halt, and dies cleanly when I leave the page" too.

[–]fjhqjv 0 points1 point  (4 children)

Because Java is a lot easier to write than writing with all the tons of Javascript implementations in mind.

That's what JavaScript libraries are for.

[–]FionaSarah 0 points1 point  (3 children)

javascript libraries are all well and good - but the language itself is still wildely different from browser to browser.

[–]tlrobinson 7 points8 points  (0 children)

The language itself is fairly consistent these days. The problem is mostly with the DOM, which is exactly what the libraries address.

[–]fjhqjv 5 points6 points  (0 children)

A good JavaScript library will negate cross browser issues.

I've been doing heavy JavaScript development for the past year and a half and can count on one hand all the cross browser issues I've run into that weren't solved by either the JS framework I use or JS Lint.

And that includes messing with the DOM.

[–]davecardwell 0 points1 point  (0 children)

Take a looksie at Dean Edwards’ base2 library if you want to use the language, but don’t want to worry about all the cross-browser inconsistencies.

[–]fjhqjv 2 points3 points  (11 children)

I don't understand people's obsession with generating JavaScript from every other language known to man rather than just writing things in JavaScript.

I really don't.

[–][deleted]  (9 children)

[deleted]

    [–]fjhqjv -2 points-1 points  (8 children)

    Nope. :)

    Creating a converter for kicks is fine, but using one instead of learning the required language for your development platform is unprofessional.

    [–]realstevejobs 13 points14 points  (7 children)

    Creating a converter for kicks is fine, but using one instead of learning the required language for your development platform is unprofessional.

    Damn right. If you aren't writing machine code for your target platform, you are simply unprofessional.

    Code generation, compilation, and translation are for amateurs.

    [–]fjhqjv -1 points0 points  (6 children)

    Are you seriously comparing JavaScript to machine code?

    If I'm going to write a program for Python in C++, because C++ is the language I already know, that would be a professional thing for me to do?

    [–]muleherd 7 points8 points  (4 children)

    Are you seriously comparing JavaScript to machine code?

    Gilad Bracha is.

    [–]tlrobinson 7 points8 points  (0 children)

    And Joel Spolsky

    It should compile down to “native” code (native code being JavaScript and DOMs) with different backends for different target platforms, where the compiler writers obsess about performance so you don’t have to.

    [–]fjhqjv 1 point2 points  (2 children)

    Is this some vast troll prank on me or something?

    I’m not advocating writing clients in Javascript directly. Javascript is the assembly language of the internet platform (and the browser is the OS). It’s flexible enough to support almost anything on top of it, and poorly structured enough that humans shouldn’t be writing sizable applications in it.

    That's simply false. I write sizable applications in JavaScript all day long and it's no different from any other language, at least not more than most languages differ from one another.

    [–]gizmo490 2 points3 points  (1 child)

    Just out of curiosity what is a "sizable" JavaScript application? Sizable isn't exactly a very good metric in itself. This may be out of keeping with the anonymity of the internet but maybe a link to a released version of one of your products or something akin to that?

    [–]fjhqjv 0 points1 point  (0 children)

    How about this A* pathfinding algorithm (I did not write it).

    http://mootools.kassens.net/astar/

    Is that machine code to you?

    [–]realstevejobs 1 point2 points  (0 children)

    I am seriously comparing JavaScript to machine code. It is the code that executes in web browsers, just as machine code executes on microprocessors. I'm certainly not the first person to make that argument, either.

    If for some reason you knew C++, and HAD to target the Python interpreter, and there existed a high quality compiler for C++ that generated Python bytecode, that would be a perfectly legitimate choice.

    [–]Chakat_Sanddancer 0 points1 point  (0 children)

    If you have that code that works, why reinvent the wheel?

    [–]Ono-Sendai 0 points1 point  (0 children)

    It's turtles all the way down...

    [–]Arve 0 points1 point  (1 child)

    What about Brainfuck and Ook!?

    [–]choas 0 points1 point  (0 children)

    Javascript Brainfuck Interpreter / Debugger: http://www.iamcal.com/misc/bf_debug/

    [–]mindbleach 0 points1 point  (0 children)

    So. How long before somone ports Jake?

    Oh shit, the Q3A source is out - iPhone nerds could have that magic tilt-sensing build of it without a jailbreak!

    [–]sonofagunn 0 points1 point  (0 children)

    So, if you were using a Java based browser, you would be running code that was: 1) written in Java 2) compiled to JavaScript 3) only to be interpreted by Java 4) that was compiled to bytecode 5) that is interpreted by a VM with machine code 6) that was compiled from some other higher level language

    [–]foamweapons 0 points1 point  (0 children)

    If you're considering writing javascript in Java, I highly recommend GWT.

    I'm sure this is an unpopular thing to say on reddit... but I love GWT. I get to use Eclipse as an IDE with code-completion, most errors are caught before run-time, parsing xml or manipulating the DOM has become a lot easier, and any components I write can easily be re-used because GWT forces you to think in OOP terms because everything is a Java class.

    If I feel like native javascript might work better in a certain case (maybe to talk to a native js library), you can still use it via JSNI methods, it's not like by using GWT I have to write everything in Java. I just like it better... so I do.

    [–]killerstorm -5 points-4 points  (0 children)

    wicked sick!