Hacker News new | ask | show | jobs
by javis 4698 days ago
Many people do enjoy writing JavaScript and view it as just as good as Python and others.
1 comments

I've dealt with these kind of programmers on numerous occasions. While they may claim to know other programming languages, they usually don't know much about them at all, in reality. If they do know another language, it's PHP, which is just about as bad as JavaScript in most respects.

Any programmer who has real experience with a variety of different programming languages will become very aware of how inferior JavaScript inherently is.

JavaScript's problems go much beyond the quirks or oddities we see with programming languages in general. They're severe deficiencies (the lack of proper modules or namespacing, and the lack of proper class-based OO), or inexcusably stupid design flaws (semicolon insertion, its broken scoping rules, its broken type system, its broken prototype-based OO, its broken comparison operators, and so on).

No intelligent, experienced, self-respecting programmer will want anything to do with such a ridiculously flawed and broken language. They surely will not see it as good as Python or any other language that isn't rife with the unjustifiable stupidity that permeates every aspect of JavaScript.

Well, that's just unnecessarily offensive. I'm proficient in Python, Java, and C, and was at some point also fluent in PHP, Ruby, and Lisp. While I wouldn't particularly enjoy coding in Javascript, CoffeeScript is, to date, the best language I've worked with. I debug in JavaScript, so I'm not that far away from it.

Why is "class-based OO" necessary? There's nothing wrong with prototypal inheritance. The way modules are done in Node is pretty powerful compared to other languages I've used. The scoping rules are different, for sure, but I don't really see why you'd call them "broken". They're internally consistent and easily comprehensible.

Semicolon insertion is, admittedly a problem. The solution, of course, is to put in your own semicolons. If you do that, and use something approaching reasonable whitespace conventions, there isn't really a problem. JavaScript's `==` the like are, for sure, broken, but that's nothing a `===` can't fix. It's not like the other languages you mentioned wouldn't have issues without reasonable conventions.

There's nothing "offensive" about pointing out realities, even if they may be painful for some people to accept.

I find your arguments somewhat odd. You do openly admit that you "wouldn't particularly enjoy coding in Javascript". People don't say such things about good programming languages, especially when arguing in favor of them to some extent.

I also find it odd that you argue that there's nothing wrong with prototype-based OO, yet claim that CoffeeScript is the best language you've worked with. One of CoffeeScript's most useful and important features is that it adds very simplistic class-based OO to JavaScript. Go look at the example code in the "Classes, Inheritance, and Super" section of the CoffeeScript home page to see what I'm talking about. The CoffeeScript code is tolerable; the JavaScript that's outputted is horrendous. Hand-written JavaScript is often just as bad, if not worse.

The various JavaScript "module" systems are purely hacks. They abuse existing language features to fake modularity, poorly. They're nothing like the proper module support of other languages. And at least you admit that semicolon insertion and the broken comparison operators are serious issues. Many other JavaScript advocates refuse to, for whatever reason.

There's nothing wrong with admitting that JavaScript is a really bad language. I think you know that it is, and want to admit it, and I think you should. It doesn't deserve to be defended, because its problems are generally inexcusable in every respect.

> There's nothing "offensive" about pointing out realities, even if they may be painful for some people to accept.

The problem is that your comments about JS tend to contain more hyperbole and opinion than undisputed reality.

JS obviously has flaws. But so does English. It's good to have a natural language that a large percentage of the world's population, across nationalities and ethnic groups, can speak. I think the same applies in programming. Programming languages are not just for telling a computer what to do; they're also for collaborating with other programmers. And once a code base is written in a particular language, it's often hard to make a case for rewriting it in a different language. So why not use a language that is popular, is cross-platform, is vendor-neutral, has multiple optimized implementations, and is likely to remain popular and well-supported for many years to come? JavaScript is that language.

FWIW, I have much more experience with Python and Lua than with JavaScript. I also do some work in C++. Yet, despite JavaScript's flaws, I'm defending it as a general-purpose programming language.

JavaScript has issues, but they are largely syntactical. Yes, `==` means something different than it does in every other language - but it is still a useful construct (if not worthy of its own operator). Yes, `Class.prototype.method` is overly verbose, but in CoffeeScript you get clean syntax without losing the beauty of prototypical inheritance.

The strengths of JavaScript, on the other hand, are deep. Everything is an object, functions as first-class citizens, the inheritance model, etc. The callback-based I/O of Node.js wouldn't work nearly as well in any other language I've seen, because JavaScript is such a good language.

I will take a language with syntactical deficiencies but a beautiful underlying model over the opposite any day, and I don't see anything about that statement that indicates that I'm a poor programmer who's only been exposed to PHP and JavaScript.

There's nothing wrong with admitting that JavaScript is a really bad language.

Your use of the word 'admitting' is peculiar. There's nothing wrong with claiming that JS is bad. There's also nothing wrong with claiming it's good.

I enjoy programming in CoffeeScript more than any other language I've used (Ruby, Python, Objective-C, a little Java, a little C). Plus, as dynamic languages go, it's fast. To me, these two things make CoffeeScript a fantastic language.

And since CoffeeScript is just syntactic sugar on top of JavaScript, well, I suppose JavaScript must at heart be a fantastic language too.

(Evidently today's my "someone is wrong on the Internet" day).

> I also find it odd that you argue that there's nothing wrong with prototype-based OO, yet claim that CoffeeScript is the best language you've worked with

You don't have to use the OO inheritance features in CoffeeScript in order to like it on the whole.

This is the key. With good conventions and tools it is perfectly fine language. The concept of "Programming into one's language" from Code Complete applies strongly:

> Programmers who program "in" a language limit their thoughts to constructs that the language directly supports. If the language tools are primitive, the programmer's thoughts will also be primitive.

> Programmers who program "into" a language first decide what thoughts they want to express, and then they determine how to express those thoughts using the tools provided by their specific language.

I disagree with Coffeescript though, nothing will make that shit readable to me. :P

What a bunch of pompous bullshit. From what you've said it seems you've never met a talented JS programmer.
Do they exist?!
I've met talented JavaScript programmers. They're just quite good at using other languages, too, and thus choose not to use JavaScript whenever possible.
I'd wager that you know as much about javascript as you do about presenting a convincing point of view.