Slashdot Mirror


Trying To Bust JavaScript Out of the Browser

eldavojohn writes "If you think JavaScript is a crime against humanity, you might want to skip this article, because Ars is reporting on efforts to take JavaScript to the next level. With the new ECMAScript 5 draft proposal, the article points out a lot of positive things that have happened in the world of JavaScript. The article does a good job of citing some of the major problems with JavaScript and how a reborn library called CommonJS (formerly ServerJS) is addressing each of those problems. No one can deny JavaScript's usefulness on the front end of the web, but if you're a developer do you support the efforts to move it beyond that?"

18 of 531 comments (clear)

  1. Javascript is actually a great language by BadAnalogyGuy · · Score: 5, Interesting

    Dynamically typed, object-oriented, with features like lexical closures that are usually only found in advanced programming languages like Lisp, Javascript is really a great language that has gotten a bad rap.

    It reminds me of the lowly tomato, a member of the poisonous nightshade family of plants, which for years was considered to be inedible. These days you can't get a salad without it. Things change when you realize how useful something actually is.

    1. Re:Javascript is actually a great language by iamacat · · Score: 5, Insightful

      Perhaps it's a great language, but it reduced modern Core i7 computers to performance of a 486, negating 15 years of computing revolution. Inability to perform CPU-intensive computations due to these dynamic types of yours, lack of threading or any other explicit or implicit parallelism support, no library facilities to modern 2D/3D graphics libraries. Javascript is a nice experimental language like so many others but it shouldn't be running 90% of mission-critical applications.

    2. Re:Javascript is actually a great language by maraist · · Score: 4, Interesting

      With no feature-set testing capability coupled with the intent of handing off raw code to 3rd party virtual engines. With no 'reference' platform to validate code (with such simple things as which string functions are supported) and no useful error messages when making language library mistakes (nor any type-safety to determine it out of the box). And with respect to dynamicity, no equivalent 'perl -c foo.pl', 'use strict', or '-warn' pragma. No package namespaces. No legitimate mechanism of loading 3'rd party library files, much less a way of namespace collision resolution/isolation. No defined order of execution (some run in-line, others run on browser completely loaded, etc).

      I'd instead say that Javascript is a frustrating language that's gotten too much rep. The fact that people migrate towards 3'rd party libraries to standardize simple programming operations (like jQuery / GWT) is a testament to how bad it's legacy has gotten - when trying to do 'real' work.

      Sure a command-line javascript can define it's own standard and I'm confident that it can solve all these problems.. That's the great thing about standards - everybody's got one.

      --
      -Michael
    3. Re:Javascript is actually a great language by mcrbids · · Score: 4, Interesting

      Javascript makes many hard things simple, and many simple things hard.

      Need to find out what the user typed in box foo? While most client libraries require fairly detailed memory schemes in order to keep track of which box is which, Javascript reduces all that to getElementById(); - a win in any programmer's book!

      But in the reverse, what about trimming that input? The offense to the mind that you have to use a USER DEFINED FUNCTION for trimming just boggles the mind. Sure, there are libraries for this, blah blah but still, the truth remains that there is no trim() function. The lack of any kind of meaningful class structure makes the special word "this" almost worthless because you can't be sure consistently what it's referring to. (yes, it is possible to figure it out, but why should you have to?) If you delete an array key directly with the delete command, eg: `delete myArray[4];` the length property doesn't get updated even though the number of elements in the array does. (WTF?!?!)

      So javascript has its warts. Lots and lots of them. It is clearly a hacked-together language that is only successful because of its ubiquity, which is the same reason why it evolves so extremely slowly, which is why we still have to manually implement things like trim(), and why so many of us are doomed to deal with javascript with all of its warts.

      Javascript, however, has been free of the browser for some time, due to the Mozilla's JS engine being modular. They call it spidermonkey, and I actually considered using it as a replacement for PHP on the server side in order to keep langauages consistent. Unfortunately, nobody's embedded it into Apache as a module (with any kind of stability) so this means that js scripts would have to run as separate executables, which causes all kinds of performance and security problems.

      --
      I have no problem with your religion until you decide it's reason to deprive others of the truth.
    4. Re:Javascript is actually a great language by Blakey+Rat · · Score: 4, Insightful

      I'd instead say that Javascript is a frustrating language that's gotten too much rep. The fact that people migrate towards 3'rd party libraries to standardize simple programming operations (like jQuery / GWT) is a testament to how bad it's legacy has gotten - when trying to do 'real' work.

      jQuery (prototype, mootools, etc) solves shitty DOM implementations, not shitty Javascript implementations. In fact, I don't think jQuery addresses a single "lack" in Javascript-- I could be mistaken-- virtually everything, if not everything, it does is fixing DOM's bad design and browser's inconsistent implementation of it.

      This is why Javascript gets a bad rap: pair it with DOM, and *any* language would look awful, because DOM is awful.

    5. Re:Javascript is actually a great language by sydneyfong · · Score: 4, Interesting

      - The speed issue is largely due to the crappy implementations of Javascript, which are improving due to competition among browsers. Javascript can be JIT-ed. What you probably can't do is compile it to native code and expect it to have the speed of C/C++. But then would *you* run arbitrary native binary code off the web? Sandboxing makes things slow again.

      - I'll give you the lack of threading.

      - 2D/3D libraries - C doesn't have one in its standard, C++ doesn't have one, in fact most don't. But you're free to implement one. It just doesn't make too much sense having a full fledged 2D/3D library in the browser, since that's where most javascript code are used in.

      - experimental language, as in first appearing in 1995, used extensively for almost 15 years. Of course most people never really utilize its full power, but it's not the fault of the language

      - And you use a "mission-critical application" written in Javascript running inside a web browser?

      Don't ditch the language due to poor implementation and crappy users.

      --
      Don't quote me on this.
  2. Getting JS out of the browser is a *great* idea. by Karellen · · Score: 5, Interesting

    Javascript is a beautiful, elegant, small and generally well-formed language. It has a couple of warts, but what language doesn't.

    However, the way that Javascript interacts with web browsers, web pages and all other things web-like is a disgusting, crufty, bloated piece of shit. The DOM bindings are horrible, as far as they go, and they're woefully incomplete. The browser deficiencies in their implementations of the DOM bindings, and the browser-specific work-arounds needed to circumvent said deficiencies, are Lovecraftian nightmares.

    (The willful violation of the javascript object model for document.all in HTML5 (see bottom of page) is one particularly nasty example of what the web has done/is doing to Javascript. If you know the JS object model well, think about what that violation really entails, and what it would take to write that special case into a JS engine, for one particular property, of one particular object, if you happen to be running in a particular environment (browser))

    Getting Javascript out of the browser would be the best thing that could possibly happen to Javascript.

    --
    Why doesn't the gene pool have a life guard?
  3. Re:My thoughts by rayharris · · Score: 4, Insightful

    JavaScript uses a different type of object than you're used to. JavaScript uses prototype-based objects whereas most other languages use class-based objects. I've seen a lot of work put into developing "class-like" objects in JavaScript and I've wondered why they just didn't learn to write code using prototypes instead.

    --
    I void warranties.
  4. A huge pain by mafian911 · · Score: 4, Insightful

    I'm not sure why anyone would want JavaScript anywhere else. I believe that the only reason why JavaScript is "popular" in the first place is because it is the only option available for client-side processing on the web.

    A lot of the pain of JS, like its inconsistent experience across browsers, can't really be held against it. Each browser has to implement JS according to its own interpretation of the standard, virtually guaranteeing a non-consistent experience across the board. I understand that. But what truly kills JavaScript for me is the lack of development tools and a solid reference. Debugging JS with an alert window is a horrible experience.

    Again, why anyone would want this stuff everywhere is beyond me. I was shocked a long time ago when Palm Pre decided it was a good idea to use JavaScript for app development. Shocked I tell you. And look where that went. Like I said, the only reason I would consider JS "popular" on the web is because there is no other way to do client-side processing. It's literally our only choice (VBScript doesn't count).

  5. Re:Why bother? by jellomizer · · Score: 5, Informative

    Yes lets put all the work on the server. The server should handle all formatting and every single error check and lets wait for the server to respond and reload the entire page to say something is wrong. Lets not have the ability to hide or move objects, because we need to reload the page over and over and over again... Never mind CPUs are Really fast and the standard Desktop has ton of memory. Lets fill up the slower bandwidth with reloading the same information over again.

    Sorry your post is screaming, I am not comfortable with JavaScript and it is effecting my 7337 status. So I will insult it so I can seem like I am skilled programmer.

    --
    If something is so important that you feel the need to post it on the internet... It probably isn't that important.
  6. Re:Why bother? by SanityInAnarchy · · Score: 4, Insightful

    I actually wish JavaScript and other client-side browser scripting would be done away with completely,

    Why?

    JS is not a particularly 'good' language.

    People who say this very often don't know Javascript well at all. It's Lisp in C's clothing. It's actually a surprisingly elegant language -- it has a few warts, but they are almost certainly not what you're thinking of.

    Google Douglas Crockford.

    --
    Don't thank God, thank a doctor!
  7. Re:Why bother? by ThatMegathronDude · · Score: 5, Insightful

    A-friggin-men. JavaScript is one of the few popular languages with first-class functions. How many JS-bashers have actually written something more than document.write() rubbish?

  8. Re:Why bother? by Anonymous Coward · · Score: 4, Insightful

    Mod parent up. Javascript, or ECMAscript gets a bad rap because a lot of code-pounders don't really know how to use it beyond defining a few c-style functions. It's a fairly powerful language once you understand the grammar. IE6 shoulders most of the blame for fucking it up - things that should work but need a bunch of ridiculous if(ie) incantations chase away most programmers from understanding the fundamentals of the language better. Once you realize that it's *even more* object oriented than Java(sun) then you begin to understand.

  9. Re:Why bother? by Red+Flayer · · Score: 5, Funny

    I am not comfortable with JavaScript and it is effecting my 7337 status.

    That's unfortunate... though perhaps now you could join the ranks of those with 1337 status?

    OTOH, maybe you were referring to TEAT status, in which case... your ideas intrigue me and I wish to subscribe to your newsletter.

    --
    "Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
  10. Re:c++ is good by ArcherB · · Score: 4, Insightful

    it's just sometimes, it's a resource hog.

    A bad workman always blames his tools

    When you are given a screw driver to drive a nail, blaming the tool makes sense!

    --
    There is no "I disagree" mod for a reason. Flamebait, Troll, and Overrated are not substitutes.
  11. Re:Why bother? by slim · · Score: 4, Insightful

    I tend to go by the thickness of Crockford's book, vs the thickness of any "Complete Javascript" book when determining how much "good stuff" the language has.

    I believe there are two reasons for this:
      1. Crockford's writing is concise and to the point. It assumes prior programming knowledge.
      2. Crockford's book does not concern itself with the DOM

    So I believe a good chunk of the extra stuff in the fatter books is "here's what a loop is", "here's what if() does", and a bigger chunk yet is about HTML and CSS.

  12. Re:c++ is good by dgatwood · · Score: 5, Informative

    The logical fallacy is only because the quote has gotten distorted severely over the years. The original saying, translated to English from Old French, reads "Bad workers will never find a good tool." This version makes much more sense.

    Source: http://www.answers.com/topic/a-bad-workman-blames-his-tools.

    --

    Check out my sci-fi/humor trilogy at PatriotsBooks.

  13. Re:javascript is good by parlancex · · Score: 5, Insightful

    How about those demos where Google was demonstrating V8, one of the "fastest" JS implementations available, which DOES use JIT to native machine code? They were PROUD to demo like a few hundred bouncing balls on a modern computer at not even 60 fps.

    Written in C you could write an app to draw and compute the motion of tens of thousands of fucking balls at 60 fps on a modern computer.

    Within 2 orders of magnitude is not "close" to C performance. Within 2 orders of magnitude is not "acceptable" performance.