r/programming • • Dec 15 '12

Why JavaScript Still Sucks

http://boronine.com/2012/12/14/Why-JavaScript-Still-Sucks/
10 Upvotes

212 comments sorted by

View all comments

Show parent comments

4

u/joelangeway Dec 16 '12

I have to do exactly that sort of thing everyday because the people I work with think in C# and the market requires us to produce JavaScript. The analogy is excellent. In fact I use backbone js to lay that track.

-3

u/x-skeww Dec 16 '12

The analogy is excellent. In fact I use backbone js to lay that track.

Are you really trying to tell me that the vast majority of cargo ships use underwater rails?

No one is doing that kind of thing.

Using classes in JavaScript, on the other hand, is something that's done everywhere.

0

u/[deleted] Dec 16 '12

[deleted]

-2

u/x-skeww Dec 16 '12

I got it just fine. It was a long winded way of calling others stupid.

1

u/DrDichotomous Dec 17 '12

Um, that wasn't my intent at all. I would in fact be calling myself stupid if that was the case. Did you just read my reply with a snarky tone, expecting a troll?

1

u/x-skeww Dec 17 '12

That hypothetical present tense scenario of that analogy clashes with reality. It suggests that using classes would be bat-shit crazy (like putting rails on the ocean floor) and that no one is doing it yet and that no one should be doing it.

However, classes are successfully used all over the place and they are far more popular than prototypical inheritance. That's the current situation.

Some people claim that prototypical inheritance is superior, but they can't offer any reason. The only pseudo argument I've heard so far is that they are so powerful that you can emulate "classical" inheritance with it. That's pretty derptastic, if you ask me.

Yes, with prototypes you can screw around with the prototype chain, but that isn't anything I want nor need to do. It won't make my code cleaner, easier to understand, or more testable. It will do the very opposite of that.

1

u/DrDichotomous Dec 18 '12

First off, I wasn't arguing against classes. Second, you're free to interpret it however you'd like. One could just as easily have claimed that trains are the sane object, and that I was implying that devs were being asked to leap into a sprawling and chaotic ocean from a nice, stable framework.

You seem to want to prove your point so badly that I doubt you realize that I'm actually on your side. You seem far too caught up in your concern that I'm painting OOP devs as somehow "crazy", and pushing your tangential point of view more than you really have to.

So I think I'll just bow out of this now, and let you have the last say.

0

u/x-skeww Dec 18 '12

Effectively, you were arguing against classes. No one interpreted that analogy as an argument for classes.

No one thinks that putting rails on the floor of the ocean is a good idea. No one does that, no one did that, and no one will do that. The ground is soft, there is lots of pressure, there is lots of resistance, corrosion is a problem, and the list goes on and on...

How could anyone interpret that kind of thing as a pro argument?

"This product smells really awful, it's expensive, it makes you go blind, and it also gives you cancer."

Yea, sure, I'd totally buy that.

My analogy was simply about removing friction. If you notice that something doesn't quite work out as you thought it would, you should fix it. Every process/workflow/machinery/etc can and should be iteratively improved till the end of time.

If it's more complicated than the equivalent of "hello world", we will get it wrong. We always use simplified models built on top of generalized assumptions. Naturally, some of the details will always be horribly wrong.

Also, things change. People didn't write big applications in JavaScript before. Now they do. We didn't have powerful CSS pre-processors in the past. Now we do. IE6 didn't support E>F, E+F, or unescaped leading underscores in class names. Now it's dead.

Some of the things you know are wrong, inaccurate, too shallow, or already outdated. It's like that for everyone and there is no escape. Some people refuse to accept that. It's quite problematic.

I think it's very important to keep those imperfections in mind. So, if, for example, enough people take the same shortcut across the grass that they create a trail, you'll be able to see where exactly you should change things. I mean, there is a fucking trail right in front of you. It's impossible to ignore.

Classes in JavaScript are just like that. There is overwhelming evidence in almost every application framework and in almost every larger application.

That's another thing your analogy didn't get quite right. You made it sound like there is a bunch of programmers who would use JS if they could just get their classes and that adding classes would make it easier for them. And that's just wrong. Almost everyone (who uses some kind of inheritance) already uses classes in JavaScript. This is the kind of hard evidence you should always look for. This is why ES6 will add support for classes. It's because of the current situation and not because they expect the arrival of millions of mythical non-JS programmers.