Live data from Hacker News

How to Learn JavaScript Properly

javascriptissexy.com

41–50 of 51 posts

Re: How to Learn JavaScript Properly

#41
post #19

I've basically just finished this process, described in the post, over the last few months. Experienced with PHP, Ruby, and SQL, but zero JavaScript. (1) - Tried to read Crockford's "The Good Parts", but was completely confused. (2) - Read "Professional JavaScript for Web Developers, 3rd Edition", cover-to-cover, making sure I used and understood each point before continuing. http://www.wrox.com/WileyCDA/WroxTitle/Pr…

If you buy the book from the above links, the coupon code WTR12 should give you 20% off.

Re: How to Learn JavaScript Properly

#43
post #40

Can anyone say what is a good JavaScript learning resource for people with programming experience? I'm interested in tips on writing idiomatic code and the pitfalls that should be avoided.

Probably the same path. I am experienced, and I found Crockford's book not right for me for a learning resource.

Re: How to Learn JavaScript Properly

#45

Earlier quoted context omitted.

Weird. I learned C from K&R and found it helpful and easy to follow. I don't think I had much coding experience either beyond c64 basic.

I learned from K&R too, and seriously, no book ever told me how closely arrays and pointers were related (atleast, whatever books I read), as TCPL. I don't find anything wrong with recommending it to 'programmers' who begin C.

K&R is great! For a really deep understanding how pointer and arrays are related I also recommend Expert C Programming by Peter van der Linden (http://www.amazon.com/Expert-Programming-Peter-van-Linden/dp...)

Re: How to Learn JavaScript Properly

#46
post #33

I'm currently in the process of learning Javascript. I've use Codecademy to get started in the basics. In terms of books, I've used The Good Parts, Javascript: The Definitive Guide, and Secrets of a Javascript Ninja. The thing I've struggled with is finding examples of 'good practice' programming which are suitable for beginner to intermediate programmers, which are more than just code snippets. I'm thinking of small…

Try reading through the Backbone.js source, it's quite approachable.

Re: How to Learn JavaScript Properly

#47
post #31
post #15

Earlier quoted context omitted.

Recommending Javascript the Good Parts to Javascript beginners is like recommending Effective Java to Java beginners. It is assumed you know some js/java and preferably have written some of it so that the patterns and antipatterns described in both books (Crockford's to a lesser degree, it's after all about the good parts) would make sense.

> Recommending Javascript the Good Parts to Javascript beginners is like recommending Effective Java to Java beginners. Or, like recommending K&R C to beginners (C beginners, but even worse to programming beginners). There are a handful of books out there that, IMHO, are vastly mis-recommended, and I would agree that JS:The Good Parts is one of them.

I don't think I can endorse this, necessarily. I learned C from "C by Dissection" back when the cover was purple. I then learned C++ from a combination of Bjarne's book and "C++ in 24 hours". Before that I only knew qbasic and vb, so it was a fairly big transition and I was young and had no experience, so it was difficult to get to a point of understanding (I did this in HS when no CS courses were offered at my grade level, so it was heavily self-guided).

I recently read K&R for the first time and found it thoroughly enjoyable and understandable going into it with the mindset of a first-time reader. I thought "I wonder what it would've been like to read this instead of how I did it, since everyone recommends it." I think I'd recommend it to others, even people new to programming.

What's bad about really terse or difficult to follow books is that they densely pack information or lack explanation and that really inhibits learning. I find that K&R raises a lot of questions without leaving the reader unsatisfied or confused, which I think is the exact opposite -- if you're really interested, you'll use that as motivation to go learn more. You might not immediately see why language features are very valuable, but I think that improves for everyone as you learn more.

Re: How to Learn JavaScript Properly

#48
post #40

Can anyone say what is a good JavaScript learning resource for people with programming experience? I'm interested in tips on writing idiomatic code and the pitfalls that should be avoided.

Probably the same path. I am experienced, and I found Crockford's book not right for me for a learning resource.

It's pretty similar. I'd avoid Crockford's dogma for a while until it's clear to you naturally why you should follow those rules (and only loosely, he's pretty adamant about things that aren't useful or are counter productive in practice: http://tech.groups.yahoo.com/group/jslint_com/message/3024).

Reading Flanagan's book is a good starting point. From there, as an experienced programmer, you might want more insight into the language and not just "how to do A, B, and C"s, so I'd recommend after working in JS for a bit to skim through the ES5 spec and read up on the future of JS to somewhat future-proof your knowledge (ES6/Harmony, and you can already use some of those features in Firefox/Chrome/Node.js to get used to them). You might want to bookmark the annotated version of the spec, as it's a nice reference to make JS feel less like a strange Twilight Zone (http://es5.github.com/).

Experience should tell you that what's important isn't usually the language, as you pick that up fairly quickly, but in the libraries and APIs that exist in various environments. Every web developer should learn the DOM for instance (among many other APIs, notably those introduced with HTML5) and should be somewhat familiar with the popular JS libraries, at least feature-wise. I'd recommend anyone new to JS read through Backbone.js's code as it's a great example of how to write quality, readable code in JS. Outside of reading and contributing to libraries, there are quite a few to learn, so experiment/play with them, watch webcasts and read blog posts about them to get a feel for what people are using them for.

That extends to more than just the browser environment, there's also Node.js, Rhino, and surely a few others. If you're a Java developer, Rhino might be a nice way to use existing knowledge of the Java API and do things server-side, and Node.js is a bit different to get started with but is rapidly catching up to other languages in availability and quality of libraries (both pure JS and bindings in other languages).

Re: How to Learn JavaScript Properly

#49
post #25

Javascript must be one of those few languages where you cannot learn from bits and pieces. I learned python, C, shell etc from bits and pieces, but I actually learned javascript the way OP describes. This is actually quite puzzling and I've been thinking for a bit. Why is it one is unable to learn from the instant utility of javascript the same way one learns instant utility in python, ruby or even C?

I wonder if it's because it's too easy to use the bits and pieces to cobble together anything you want without having to understand completely how they work.

Re: How to Learn JavaScript Properly

#50
Do not try to learn JavaScript the first time from bits of unrelated or related JavaScript tutorials online—this is the worst way to learn a programming language.

Is this really true, from my experience the people who were self educated had a remarkable perseverance to get the job done and were particularly good at mastering the non-programming parts of the work such as client relations, math, science. I think its the best way to learn, because it also teaches you how to learn.

Post reply on HN