4 ms·
I have not tried Node (or in fact JS as a whole) yet. But it seems very hard to avoid JS in these days. I am going to learn it in a few months. Can anyone give
by blacktulip 14y ago
I have not tried Node (or in fact JS as a whole) yet. But it seems very hard to avoid JS in these days. I am going to learn it in a few months. Can anyone give me a rough idea how bad it is? (I know some Obj-C so is JS worse than that?)
- superbobry 14y ago[1] can give you some insight on the dark side of JS. Also, avoiding JS in some way or another is not that hard, esp. since there're a lot of languages which compile to JS, most notably CoffeeScript and ClojureScript. * [1] http://wtfjs.com * [2] https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS
- dagw 14y agoAs much as I love CoffeeScript, it's not a substitution for learning JavaScript. CoffeeScript is basically just JavaScript with a prettier syntax and if you don't understand JavaScript you won't understand CoffeeScript.
- pooriaazimi 14y agoVery true. I love CoffeeScript very, very much. It's my favorite language - I like it even better than ruby, if you believe me! I like using indentation instead of stupid 'end's that only God knows are ending a loop or a def or something else, I like the use of ... instead of * (for splats), and a few other things. But, as much as I like CS and hate (really hate) JS, I have to agree with you wholeheartedly. You must know JavaScript well. Variable/function hoisting won't bite you in CS, but other JS idiocies will. Read Douglas Crockford's "JavaScript: The Good Parts" at least twice (and take a lot of notes). It's the best no-bullshit book on JavaScript (the language, not "how to use JavaScript in Node/front-end web design") around.
- codygman 14y agoIf you like how CoffeeScript is tab delimited, you might also enjoy python.
- cometc 14y agoThat is completely true, you can't treat CoffeeScript as a replacement for learning Javascript in fact I'd say you need to have a pretty strong understanding of JavaScript to really use CoffeeScript well. That said CoffeeScript does some nice things to prevent typical small js errors for newer devs.
- dagw 14y agoInstead of worrying about how bad JS is, read JavaScript the Good Parts and Effective JavaScript and focus on how good much of it is. Yes, JavaScript has oddities and there is a quite short list of pitfalls you have to learn to avoid ('==' vs '===' for example), but it also has some very powerful features. Take the time to actually learn actual JavaScript, as opposed to assuming that it's basically a bad Java (or whatever) with slightly different syntax and you'll find a pretty neat and powerful language.
- PommeDeTerre 14y agoComing from Objective-C first, which is generally a rather sensible language, I think you'll be surprised at how stupid, unnecessary and inexcusable many of JavaScript's problems are. People who only have a PHP background, for instance, have become accustomed to such stupidity. They think it's "normal", solely because they don't really know any better. Those coming from C, C++, Java, C#, Ruby, Python or most other languages, on the other hand, know that the JavaScript way is not the right way. These people generally have a much harder time coming to terms with JavaScript's numerous issues.
- drewmck 14y agoI was speaking with a colleague about Node and he suggested using Coffeescript instead of JS directly for the exact reasons you mentioned. I'm also coming from Obj-C, C and Ruby background and recently read "Javascript: The Good Parts". I'm still looking for the good parts promised in the title and introduction.
- damncabbage 14y agodagw has the best response to this below: http://news.ycombinator.com/item?id=5054382 http://news.ycombinator.com/item?id=5054382 I agree; it's a shortcut for people who know JS, not for people who are learning it for the first time. As soon as you need to use or look into the internals of a library that isn't written in CoffeeScript, everything's going to get unstuck pretty quickly.
- calibraxis 14y agoI personally happen to disagree. (I have production/team experience with both node.js and CoffeeScript.) For many learning types, I'd guess it's preferable to leisurely learn JavaScript from the shores of CoffeeScript. Rather than having to deal with all of JavaScript's absurdity at once. And when you need to read someone else's JavaScript code, you can usually get away with ignoring boilerplate.
- nicholassmith 14y agoI think that's my biggest problem, my background is heavy on C/C++, and moved onto C#, Ruby, Python and Obj-C later and whilst I think Javascript is fine in terms of providing functionality for web pages, the language doesn't lend itself to a large implementation like NodeJS unless you're supremely well versed in it.
- vardump 14y agoJavascript is overall cleaner than Obj-C. Both languages can of course be used and abused in many ways. Javascript is going to require less code in general. On the flipside, larger projects are harder to keep maintainable. There are some trivial gotchas in Javascript, but same can be said for most languages. Most importantly weird type promotion system, variable & function hoisting and prototypal inheritance can cause some gray hairs. All those can be lived with, and prototypes are in some ways superior to "classical" inheritance. C, C++, Java, Javascript, Lua(JIT), Perl and ObjC are languages I normally use.
- chrismsnz 14y agoPick up "Javascript: The good parts" by Douglas Crockford and don't look back.