Live data from Hacker News

CoffeeScript Means Giving Up on JavaScript

w2lessons.com

21–30 of 71 posts

Re: CoffeeScript Means Giving Up on JavaScript

#21
As much as I don't like the analogy of JavaScript as the assembly for the web, this feels like a fully general argument against learning any language besides Blub, where Blub is some 'base'.

"C means giving up on x86 assembly."

"If we're already willing to learn both languages and then spend time reading and debugging assembly code, why not just write good assembly code from the start? For the extra effort you'll make learning C and its and its compiler's idiosyncrasies, why not put it towards really learning assembly?"

I'll tell you why. Because while the initial cost of learning CoffeeScript (or my own preference, ClojureScript) may be high, once that barrier is passed the benefits of those languages mean at minimum that you're writing more-likely-to-be-correct code faster. A master C programmer beats a master assembly programmer.

One nice thing about ClojureScript is it lets you hook up a REPL with a browser window which is great for many debugging needs, you can't do that in JS without something like Firebug (which has its own quirks). The interesting note there is that ClojureScript, and I imagine CoffeeScript, are marching steadily toward the place where you don't need to know JS anymore, and learning it is something you only do if you want to.

At one point you did need to know at least some assembly to really do C, especially because you'd have to help the compiler out when it generated stupid code. That age is long gone (except in the microcontroller world but Arduino is making headway on that), many programmers learn C and never learn any assembly. (Not to mention the matter of which assembly.) You might have to learn a bit about computers like the concept of memory and pointers to do C, but those aren't fundamentally assembly features, just like needing to learn about the DOM and browser events in ClojureScript/CoffeeScript isn't a fundamental JavaScript feature. (As anyone who has done anything with RhinoJS knows.)

Re: CoffeeScript Means Giving Up on JavaScript

#22
I really hope that we can finally end the tyranny of Javascript and allow programmer freedom. This is why PNaCl is so exciting -- just send LLVM bytecode which can be executed more directly and efficiently. You can choose whatever language you'd like! Imagine if every server (every. server.) had to run PHP on the backend and Java, Ruby, OCaml, even C just compiled to PHP. You would go insane. We don't have that situation on servers, but we have it on browsers.

It would not be so bad if the underlying language was more direct -- after all, we mostly run on the x86 ABI which is also insane, but much less so. I don't use Javascript that much, but it appears to be a hacked-up version of Self that you need to include weird modules to do anything with?

Re: CoffeeScript Means Giving Up on JavaScript

#23
post #4

You can't write a program in C without knowledge of assembly, unless you're willing to defer debugging to someone who does. You can't write a line of code in any language if you don't know, on some level, what it's doing in the machine (whether physical or virtual). Sure, you can , but you're not a programmer, you're a tinkerer. To really program, you need to know assembly. But at some scale, your application becomes…

> To really program, you need to know assembly. That's just an absurdly untrue statement.

Well you don't need to know opcodes, but that's an implementation detail. If you don't have at least a basic understanding of what the machine is doing, you will never be able to really understand the code you write.

Re: CoffeeScript Means Giving Up on JavaScript

#25
post #4

You can't write a program in C without knowledge of assembly, unless you're willing to defer debugging to someone who does. You can't write a line of code in any language if you don't know, on some level, what it's doing in the machine (whether physical or virtual). Sure, you can , but you're not a programmer, you're a tinkerer. To really program, you need to know assembly. But at some scale, your application becomes…

> To really program, you need to know assembly. That's just an absurdly untrue statement.

All abstractions are leaky to some degree. There will be problems you don't understand if you don't know what's happening one layer down. This is not to say there's something wrong with being a tinkerer - but it is saying that there is a difference between a tinkerer and a professional. http://www.joelonsoftware.com/articles/LeakyAbstractions.htm... for better writing on this topic.

Re: CoffeeScript Means Giving Up on JavaScript

#26
post #23

Earlier quoted context omitted.

> To really program, you need to know assembly. That's just an absurdly untrue statement.

Well you don't need to know opcodes, but that's an implementation detail. If you don't have at least a basic understanding of what the machine is doing, you will never be able to really understand the code you write.

Let's take someone who has learned Ruby outside of the classroom and is now attempting a relatively simple Ruby on Rails site. What disadvantages does he/she have not having studied assembly (as most com sci/engineers do at some point in their coursework)? Are these disadvantages major compared to, say, the disadvantages of not having learned HTML and attempting to be a RoR dev?

I would guess no. But I've learned both assembly and HTML so I can't tell for myself how much either has influenced me in ways that I'm not conscious of. Except that I actually use HTML knowledge when designing RoR views.

Re: CoffeeScript Means Giving Up on JavaScript

#27

I really hope that we can finally end the tyranny of Javascript and allow programmer freedom. This is why PNaCl is so exciting -- just send LLVM bytecode which can be executed more directly and efficiently. You can choose whatever language you'd like! Imagine if every server (every. server.) had to run PHP on the backend and Java, Ruby, OCaml, even C just compiled to PHP. You would go insane. We don't have that situa…

Whoa, JavaScript is so much better then PHP.

Re: CoffeeScript Means Giving Up on JavaScript

#28
I like to use the same language on client and server. Especially when CoffeeScript doesn't really address the problem of handling errors thrown in asynchronous callbacks in Node.js. I'm talking about having to try/catch all your callbacks, plus passing another callback to be sure the control returns to the (asynchronous) caller in case of error. I wrote a micro library to encapsulate callbacks using a terse syntax, but it's still something I'd like to see in the programming language itself.

Re: CoffeeScript Means Giving Up on JavaScript

#29
CoffeeScript will mean giving up on JavaScript. The more popular CoffeeScript becomes, the less proficient the overall developer population will be at JavaScript,especially if they spend most of their time writing CS over JS. The problem at the moment is that the world still works in JavaScript, not CoffeeScript.

He rightly draws the analogy between jQuery and JS. I spend a lot of my time working on jQuery core, and we have definitely seen the phenomenon described in that blog. Five years ago when jQuery was created, just about every web developer knew JS quite well and understood the quirks of every browser and JS implementation. Now, they just assume that if something doesn't work consistently in IE6 then it must be a jQuery bug, because you know, jQuery is cross browser. People are now programming in jQuery and have given up on JavaScript.

If you're a CoffeeScript pioneer you don't see this. You already know the hard and ugly JS things that CS makes easy and beautiful, just like the early jQuery adopters. A few years from now if browsers haven't created native CS implementations but CS is popular, novice programmers will be dealing with the same jQuery-vs-JS dilemma. For example, programmers with weak JS skills will write CS and be baffled by the errors thrown from the bowels of the JS code they are forced to debug.

Post reply on HN