Javascript vs CoffeeScript vs Dart vs Traceur?
I'll be starting a new large web project at work soon. I'm currently trying to decide what language to use but am a bit overwhelmed by all of the options. I have a lot of Java and Python experience and moderate amount with Javascript. Not really a fan of Javascript as a language so am researching the alternatives. (probably going with AngularJS as the front-end framework and either Python or Nodejs for the REST/JSON backend)
Current impressions:
-
CoffeeScript : Includes many of my favorite features from Python. The syntax seems a bit unintuitive but maybe it's not bad after you get used to it. Not sure if the overall benefits CoffeScript will be worth the extra hassle?
-
Dart : Sounds cool enough. Honestly I'd probably be happy to use either Coffee or Dart. Not sure which one will "win" in the long run, though, and am afraid to bet on the wrong one...
-
Traceur : "Traceur is a JavaScript.next-to-JavaScript-of-today compiler that allows you to use features from the future today."
Traceur seems like it might be the best choice because it would presumably make Javascript more tolerable and I wouldn't have to gamble on the unknown future of "yet another" language. Haven't really seen any buzz about it, though, which seems kind of strange.
If anyone has experience with one or more of these options I'd love to hear about it! Thanks
Posted Oct 19, 2012, 10:36 PM UTC
Stick with plain old Javascript until you understand it's problems.
This^ time 1,000. Tools are either vitamins or aspirins. Vitamins are nice, but aspirins solve headaches. Until you know what kinds of headaches you'll have, all we can do is recommend Zinc and Vitamin D.
Besides, even if you were leaning towards my current choice (CoffeeScript), I'd ask you to think very carefully before deciding that the beginning of a new, large web project is the right time to take on a new language and new tooling and find yourself asking "Backbone or Ember.js or...?"
Better to try a new language on a small project, where if worst came to worst, you could lock yourself in your office over the long weekend and port everything back to JavaScript. You'd still have all your domain knowledge and you wouldn't be fucked.
For what it's worth, I've written almost 10,000 lines of Javascript. Not a ton but enough to know that I'd rather not do another 10k of it if I can avoid it. :-)
I agree with your point about trying it on a smaller project first. I'll see if that's a possibility.
TypeScript is rather new, but it's adds features to JS instead of re implementing a total new language. I would check out that.
I've always disliked JavaScript vanilla, but recently I kind of fell for jQuery event driven programming and nice DOM search operators. It is smooth. Otherwise, I use Perl, which is also very smooth in its own way.
Funny you mention that. JQuery is probably the main reason I got back into javascript. I did a smattering of javascript years and years ago and hated it. JQuery has made it soooo much better!
Could you explain to me how jQuery helped you write event-driven code? I'm genuinely curious, because I know it's possible with vanilla as well. Also, I've seen a whole lot of cases where jQuery encouraged novice javascripters to write bad code, and I'd be interested in seeing the opposite.
In that case, it would be really helpful if you could tell us why you personally would rather not write another 10,000 JS/LOC. Then it would be easier for us to recommend the right analgesic :-)
Mind if we see some of your code then?
[deleted]
Agree. At the end everything compiles to JS and you need a solid understanding of Javascript before you should move on to a different language. Personally after getting over the flaws of the language I started to like JS a lot.
Personally, I learnt more about JavaScript, and loved it, only after I switched to coffeescript.
I've met plenty of PHP programmers who have the same mentality. They have only coded in PHP, and see no point in ever trying Ruby, Python, JavaScript, Java, C#, Haskell, whatever; because they feel "I can do it in PHP, so why switch?".
Nothing wrong with PHP, but there is something wrong with a closed mind.
True, but I didn't say that. In fact when you're comfortable enough with javascript it makes sense to go for something like Coffeescript or Typescript. But only then! The difficulty with languages that compile (or 'transpile' if you will) to javascript is that they add an extra layer of abstraction. In the long run that will be helpful but at times you will need to understand the code at the, say, Coffeescript level and simultaneously at the javascript level. The languages you mention don't have this caveat.
So I'm not argueing against coding in languages on top of js but I'm saying you better know js very well.
You more or less did, and your point certainly wasn't related to the complexity brought by additional layers of abstraction.
Again, I disagree. Why go with something that is as close to JS as possible? just like JS? You won't learn anything, you'll just have a new tool to play with. Again it's the closed mind mentality, where if you have a hammer, everything looks like a nail.
I'd recommend just trying lots of languages, learn what makes them different, and different at solving problems. Even if you stick with JS, it'll help you approach problems from a different perspective.
Those other languages don't all have to be JS-like ones; plenty of stuff compiles to JS these days.
I'm sorry, I guess I was under the assumption that the OP was debating what JS-like language to pick. Now I see he didn't make that explicit buit it certainly looked that way to me :-)
[deleted]
this is why I hate talking to people on the internet. we are in a javascript forum, on a javascript thread, talking about the differences in different javascript related languages. how in the fuck could you have possibly thought he meant what you thought he meant? Beyond that, once you made the initial mistake, how in the fuck could you possibly come back here and try to defend yourself in your misunderstanding? Just accept that you made a mistake and move on.
like the man said, stick with plain old javascript until you understand its problems.
and, let's face it, using anything else is just asking for trouble if you are planning on deploying to the wild.
your idealism is heartening, but incredibly misplaced, and your attitude just plain stinks.
[deleted]
And just hope your code works in all browsers? or use js with something like jquery?
If you don't know how to write vanilla javascript that works in every browser then you really shouldn't be looking at libraries like jQuery yet.
That's kind of the point of jQuery so you don't need to care about the differences. Why stop there? Maybe you should be able to code up a JavaScript vm in every OS before you write any js code or maybe you need to be able to write all of the different OS's before you start writing applications or vms for them at all or learn how to start with a pile of sand and build a CPU...
I didn't mean be able to write a complete polyfill for addEventListener, I meant knowing what does and doesn't work cross-browser, so that you don't end up doing something stupid like posting to StackOverflow asking "how can I use jQuery to find the text in a textarea?"
That's the most idiotic bullshit I've heard in a long time. I doubt anyone can do that, unless it's for a small subset of Javascript, like Javascript that doesn't involve the DOM.
[deleted]