Hacker News new | comments | show | ask | jobs | submit login
Javascript is good enough (alarmingdevelopment.org)
28 points by jefffoster on Jan 31, 2009 | hide | past | web | favorite | 21 comments



[Javascript] is good enough in exactly the way that MS-DOS was good enough.

That's unfair. It's also, to judge by the rest of the post, a snap judgment with more than a little bitterness in it. ("It is good enough that you can deploy hordes of programmers to produce crappy software that sort of works. And that is good enough for making money.")

My project does things with JS that I would never have thought possible. It has not let us down. The regularity and dynamicness of its core are reminiscent of Smalltalk and Lisp. There are annoyances, of course. But the one the OP places the greatest emphasis on - that all hash keys are strings - only caused us trouble once, and in that case we found a simple workaround. I'm curious: have other people here experienced that limitation of JS as a fundamental obstacle?

Given that the OP holds out Java, ActionScript, and that let's-turn-JS-into-Java thing as examples of how it ought to be done, I'm reminded again of how grateful I am that we have something as flexible as JS for making programs that run in a web browser. It's not what I would have chosen, but it's a hell of a lot closer than anyone could have expected, given the rest of computing history. We got lucky.

Edit: Oh, and they - the arbiters of programming correctness and staticness - can't do a thing about it. It's already taken over the world.


But the one the OP places the greatest emphasis on - that all hash keys are strings - only caused us trouble once, and in that case we found a simple workaround. I'm curious: have other people here experienced that limitation of JS as a fundamental obstacle?

Yes, any time you want to use a non-primitive type (strings, numbers, etc) as a key to hash map.

But we solved it in Objective-J by automatically giving each Objective-J object a unique "hash" value.

(of course you could do something similar in plain JavaScript, but you'd have to implement it yourself)


This is one of those features that I've read Lua has and JS doesn't that sounds really good in theory. But I haven't ever run into a situation where I've wanted an index other than a number or string. It's probably just a blub paradox though; I'm curious, in what situations are other values particularly useful as keys?


Any time you ever need to map an object to another object, you need this functionality.

Without a memory address, object's don't have any other unique values associated with them. It's actually a pretty fundamental problem.

Of course, like most things wrong with javascript, you can fix it if you work for it. Objective-J fixes all the things we had problems with, and this is one of them. A lot of things in Cappuccino would not be possible without the hashing feature Tom mentioned.

As a hash table, JavaScript objects are pretty awful. You can't get a count of objects unless you literally count all the keys. And you can't iterate over the keys if anyone else has added anything to the Object prototype.

Cappuccino has a proper hash table, CPDictionary, which solves both of those problems. There's a lot of other data structures that address some of the author's listed concerns.


In Lua I've done stuff like maps of functions to tables of functions for permuting different methods of computation... kinda wacky but it does what I need.


Ah, I get you. We haven't needed that yet.


Wow, there is allot of love here on HN for JavaScript!

I thought I would chime in with my thoughts, only because I've been thinking about and working with both Java and Action Script a bit lately.

I'm a hobby programmer, I like to make small games. I've tinkered with many languages and frameworks over the years. Pascal, D, Basic, lots of Python and most recently JavaScript and Action Script.

My new project is a web app with Python on the backend. I have written the front end twice, once in JavaScript and once and Action Script.

For me, what really matters how quickly and easily I can express the everyday stuff that fills up 90% of my programming time, not what fancy features a language has.

In my mind, Python beats Java and Action Script hands down. I can understand the author of the original article expressing dissatisfaction with what we have now. I understand his plead for more!

JavaScript does feel like DOS to Pythons Windows when you are working in each every day.

JavaScript is cool, but Action Script shows how it can be cooler.


This article is obviously a random snapshot of some impressions the author has. But this line strikes me a grossly unfair.

> The web development community consciously chose to stick with a pathetically crippled technology to avoid having to change.

The JavaScript language has its limitations and crufty (but standardized) aspects. But calling JavaScript pathetically crippled tells me the author has no clue. And saying that the web development community to to stick with it to avoid having to change shows even more ignorance.

The web development community has chosen to go with JavaScript in the ECMA-262 form because it is open, standardized and runs in every browser. The alternative would have been (and still is) choosing a language on a proprietary runtime. Because, yeah, that would have been good for the open web, standards and end-users, right?

JavaScript is actually quite powerful. I do a lot of JS programming and have built sophisticated systems in it. What's hard about JS programming is interacting with the host environment (primarily the DOM and loading structures). Building complex and powerful pieces of code in JS is much, much easier than doing the same in Java or C#, both of which have been shoehorned into the browser (though comparing these languages with JS is not fair or even very relevant).

JS is a standard and it's in every browser. This means we can program complex client-side applications that will run even an ancient browser like IE6 (which is, unfortunately still standard for business). And we do. I've loaded our main application into Opera on the Wii and Safari on the iPhone without modifications. I've even had it running on the OLPC candy box.

Good luck trying that with Silverlight, AIR, or what have you.

I'm all for having multiple languages for platform-independent development. But I currently don't see any other language than JS as an option.

If you're going to moan and whine about how JS sucks, please provide other reasons than some arbitrary aspect of the language while ignoring all the positive aspects. And if you're going to accuse web developers in general of laziness, please provide alternatives.

Money, you know where to put it, right?


JavaScript is /way/ better than good enough. It's terrific. It's the only programming language many people need to produce really amazing websites and web application that make the world a richer and more promising place for a lot of people.

It's good enough to get you $40-50/hr easily.

It's good enough to build platforms and APIs and tons of libraries given freely to the community by companies including Yahoo, Google, and startups you've never heard of.

It's a beautiful language and /extremely/ powerful. To judge it poorly because hash keys are strings is so short sighted that I doubt the credibility of the author.

If you are new to programming or want to try something out, go for JavaScript. You can build a simple website in HTML and if you know JavaScript, you can plug into a wealth of information just by typing some code into a browser window and hitting save.

Look at what any of the major mapping websites let you do. Entire platforms as a service. And now with the Pre out, you'll be able to build websites with javascript that function natively on the phone. The iPhone makes you jump through hoops to do something like that.

JavaScript is big big big and it doesn't have anything to do with hash keys. It has to do with a network of like-minded individuals pushing it forward. Not for money, not to make it easier, not to win control, but to create a platform on which we can all collaborate and build an Internet that helps us communicate.

Look at the power right here on Hacker News. The arrows, when you click them, the page doesn't refresh, it just sends a quick little request back to the server and the arrow goes away and ur done, no waiting, no pauses.

Now, that is, technically a RIA, or an AJAX site. Now, if you want to get all technical about it, it's not even AJAX because the X isn't there. In that way, Hacker News is more of an AJ site. Anyway, this isn't my point...

My point is, it's all HTML and just a few clever little lines of JavaScript and you have a very functional system that works in any browser that supports Javascript and if it doesn't support javascript, it still works and that's amazing. It's like JavaScript is so simple to add so much functionality and speed to a site and a life.

I don't even know why the author went all into Action Script, what does that have to do with JavaScript? Because Action Script does hash keys the way he likes it is awesome and JavaScript is just good enough?

No way I say! I love JavaScript. It's an Internet Standard. Don't discredit the value of that. Standards bodies like that don't just go around choosing all willy-nilly, they think about the decision long and hard and they make a good one and JavaScript is a good one and it'll do everything we need for a very very long time.

And everyone wants it to stay that way. Everyone's also trying to fill in its gaps and make some hard things easier and that'll always be expected and that's great, but the author didn't compare it to Silverlight and didn't compare it to Java Fx and all the other RIA platforms, only ActionScript and ...

You know what, look at this other post: http://alarmingdevelopment.org/?p=66 Where in 2007, the same author says, "People are finally realizing that HTML is incapable of supporting a sophisticated user interface. AJAX is a reeking pile of hacks and cluges that offers only a glimpse of what could be possible with a halfway-intelligent browser platform."

A lot of really cool stuff is done in Flash. A lot of really nice things are done with JavaScript too and I think those kinds of statements are outlandish. JavaScript/AJAX, whatever you want to call it have problems and frustrations and so does Flash. To mention one or a couple reasons where one excels over the other misses the big picture.

The big picture is that JavaScript is what the community has chosen. The community of the expert people for everyone that is good and JavaScript is that and it probably will be for a long time.

I feel like, and when I say "feel like" I mean my gut, without numbers to back it up, tells me that JavaScript is super powerful and widely supported by a lot of people for a very good reason. Why don't the flash people stop with the action script and start using JavaScript?

Is it because someone is going to have to change? All the people who like Action Script are going to have to learn JavaScript? Or are the Action Script people expecting all the JavaScript people to give up JavaScript and learn Action Script?

There's a very backed in a corner feel to all of the posts. Like some sort of weird undertone I can't quite put my finger on, but I don't think I agree much with what the author has to say.


"It is good enough that you can deploy hordes of programmers to produce crappy software that sort of works. And that is good enough for making money."

Well, I respect the author for he is a Fellow at MIT. But that's quite unfair. So Gmail is a crappy software? People have done great stuff with JavaScript and it's not for money. For me, though I neglected the language for some years as I always thought it's a toy language (lesson leanred: always try rather than listening to complaints) but despite its shortcomings the language has a strange appeal. Also, I know for a fact that good JavaScript developers are not in abundance. The way author has tried to compare Java & ActionScript--which is totally beyond my comprehension. I think I'm moderately competent but I can show author quite a few things that can be expressed quite elegantly in JavaScript than say Java. I'm actually surprised as to why someone at Software Design Group at MIT would bash a language with comments like "crappy software that sorts of work. And that is good enough for making money" ;(


I'd be the last to say that Javascript doesn't have its proper place, all of the sites I'm working on use it to some extent.

But I'd not call it 'good enough' as in a replacement for all those other programming languages that make up todays palette, it is simply good enough for its intended purpose, which is to extend web pages to include features for which tags are too limiting, including underwater communication with a web server in order to make dynamic changes to a page that has already been served.

JavaScript to me is a means to an end, definitely not a general purpose programming language. Though technically you can write anything in it (it's Turing complete after all).


JS has some issues, but it's got a lot of really cool features. It's got closures, an eval function [so you can do

    eval("somefunc()")
or

    eval("3+5")
and it will evaluate that command.]

It's a little Ruby-like in that it draws on a lot of language idioms. It has objects, yet it has some functional seasoning thrown it.

And that functional seasoning is used a lot with the frameworks like jQuery or even Ubiquity, the firefox extension. Both of them make heavy use of being able to just pass "function(){ ... code ... }" as parameters.

It may have some issues, but it has a lot of power and extensibility too.


I think Javascript has gotten a bad rap because of early implementations and its association with bad experiences of coding in web browsers. Here's a link on learning Javascript from the command line:

http://www.thefrontside.net/blog/learning_javascript_from_th...


> First-class functions - great.

The author magnificently understates how useful closures can be.

Besides this, the author has posted a single complaint about the language (one that I don't find particularly important) and then seems to act as though the language is completely unusable.


> The author magnificently understates how useful closures can be.

I didn't see a reference to closures in the article.

I know you probably know this but first class functions aren't closures.

The wikipedia article for them doesn't even mention closures: http://en.wikipedia.org/wiki/First-class_function


This is a post about JavaScript as a whole, and so I can only hope he meant "first class functions and closures". If he didn't, well that would be even more worrying.


For an opposing opinion in reply to this post: http://blog.mendix.com/?p=138


Reading...okay, reading...okay, reading...what? Aw c'mon. What about...meh. Back to less alarming development.


JavaScript itself is a great language, not just good enough. It's got higher order functions, closures, prototype-based object definitions and all sorts of other lovely, lovely things.

If it's not the language you like off the bat, you can redefine the core objects until it is.

Beautiful!

For people think it's like MS-DOS, I can only assume that they think so because they don't understand it truly as a language. Pure JavaScript is a thing of beauty.

The DOM API that most browsers expose (as per spec -- and worse, as not per spec) is, on the other hand, a steaming pile of crap.

The DOM API has gotten more consistent and less crap over time, but its design is still ugly and inefficient (and browsers still differ in annoying ways).

Which, of course, explains the huge success of Prototype (which redefines the whole language into a more Ruby-like one), and jQuery (which hides the DOM stuff for people who want to avoid it).

I'd estimate that now, JavaScript has the most developer attention of any "upstart" language -- and that means it'll get even more exciting in the future.

Granted, as somebody who's given training courses & talks on JS, written an (unpublished) JS book for O'Reilly (damn them), and recently cowritten a JavaScript performance ebook (http://jsrocks.com) with my husband Thomas Fuchs (the script.aculo.us dude), I might be biased, but, such is life. ;)

As an aside, I don't know ANYONE who knows both ActionScript and JavaScript and prefers Adobe's to the real thing. (Other than the post author. But I don't know him.)


> JavaScript itself is a great language, not just good enough. It's got higher order functions, closures, prototype-based object definitions and all sorts of other lovely, lovely things.

Exactly, and these things let you use it in any way you like. If you're frustrated with and feel limited JavaScript, then you just plain don't understand it.


Meta: I wish I could upmod the comments/discussion instead of the article itself.




Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | Legal | Apply to YC | Contact

Search: