(3) - Went back to "JavaScript - The Good Parts" and realized that "Professional JavaScript for Web Developers, 3rd Edition" had already covered everything in it, but explained so much more clearly.
(4) - Now I'm trying intermediate to advanced JavaScript books ("Secrets of the JavaScript Ninja", for example), and finding that "Professional JavaScript for Web Developers, 3rd Edition" covered most of their lessons, too.
The point?
If you want to learn JavaScript, (or recommend one book to someone else who wants to), whether you're an experienced programmer or not, get "Professional JavaScript for Web Developers, 3rd Edition". It's thorough and great.
Direct link to the publisher where you can get the DRM-free PDF:
"But while Mr. Crockford, who is immensely knowledgeable in JavaScript, is seen as the Einstein of the JavaScript world, his book, The Good Parts, is not a good JavaScript book for beginners."
Why not?
Also, does he mean it's not good for people who are just starting to learn programming? Or also for experienced programmers who are starting to learn Javascript?
What would be a good book to start with for experienced programmers just starting to learn Javascript?
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.
Crockford's book explains the best practice in a comprehensive way, but it does not explain why you would want to follow those practices. You need to have sufficient experience with the consequences of bad practice to recognize when and why you would use the practices from the good parts. I wouldn't say you need any javascript experience per se, but a solid background in software engineering is definitely helpful.
>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 found K&R C to be refreshingly easy to follow, but that isn't saying much because prior to that I had learned C++ from Stroustrup's book (which I had to read three times cover-to-cover before I finally understood what in the world he was talking about). Any book would seem easy to follow after that pan-galactic gargle blaster.
And now I'm sure someone will respond saying that they found Stroustrup's book remarkably straightforward. To each his own I suppose.
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.
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.
Because Crockford's viewpoint in the hands of a beginner is at best dogma. I think you need a solid base understanding of Javascript and some experience under your belt before The Good Parts comes into its own.
Immediately after the sentence you quoted above, the article went on to say:
"Crockford’s book does not explain the JavaScript concepts in a thorough, clear, easily digestible form."
I too found that to be pretty dubious advice. I try not to recommend people any books or tutorials unless I've seen it and it's clearly a good beginner's resource or I personally found it to be invaluable when I, myself, was starting out on a language. Crockford's book is the latter. It doesn't teach you the raw basics, sure, but there are many resources for that (I'd recommend Eloquent: http://eloquentjavascript.net/contents.html), and Javascript has fairly simple C-like syntax anyway, so it's not hard to pick up tangentially. The Good Parts gets you thinking about the language in a different way - that, plus the annotated spec (http://es5.github.com/) really sets you on the right road to mastery.
I suspect it's more likely to be "mind blow" for experienced programmers of less dynamic languages than novice programmers. Indeed, if you start by declaring functions as variables you're halfway there.
The way you pass around functions in, say, PHP (or more accurately, the way PHP fakes it by using syntax sugar for eval) is a lot more confusing.
That book is the only one I read. It was quite good for telling me the language features like object notation. But did not really help me get in the mindset of asynchronous callbacks. I learn that myself and I eventually discovered Deffered in JQuery and the rest is history (now I use angular.js)
This is really nice. I've taught JS to several people and the best advice is to try to avoid reading snippets from the web if possible. This is a good approach and I'd also recommend:
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?
With an overall appreciation for languages in general, JS isn't too difficult to pick up small pieces... I'm completely new to JS, but can get by with modifying examples for use in Parse.com's cloud code for instance. I've also heard from non-programmers getting good results with jQuery. I'm now looking to delve deeper into JS through Node.js, but each to their own.
JS is actually very easy to pick up in small bits. But somehow picking up the knowledge in small bits tend to lead to quite crappy programs. At least in my experience
That's certainly very true. Like any technology, there's learning how to use it, and learning how everyone else uses it. JS is almost too flexible, allowing programmers to get themselves very stuck - so learning how everyone else uses JS is an essential goal in its own right.
I think one of the biggest issues with JS is its lack of an intuitively obvious inheritance scheme. Until you get a full grasp of prototypes, you're not going to really know what the all the objects are. Couple this with a lack of namespacing and you can have a lot of trouble structuring large programs effectively.
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.
I've tried to teach my friends and acquaintances that are interested in programming, but my curriculums never work out. It seems that the bigger problem for the guys I'm talking about (high school and college age) is self-motivation and drive that they are unfamiliar with from their academic careers. Anybody motivated enough could learn programming because all of the necessary resources and training is freely available. The OP's curriculum looks like a fantastic way to get into JavaScript for somebody motivated. The bigger question then is, how do you motivate somebody that likes the idea of programming to also happily accept the hard work involved?
I guess the key to staying motivated is the need to apply these (potential) skills to actual real world problems - no matter how small they may seem.
That said, I'm trying to get into Rails and Ruby and I'm in a similar boat as the friends you described. At work I'm a FileMaker developer, which might sound like amateur hour to the HN community. I'm very well aware of FileMakers shortcomings, but it also works quite well for our little non-tech company, which is why there is no immediate need to learn more advanced languages. Add to that outside my day job, I'm a musician/producer - this is a hobby as well as an occational source of income, but it takes time and there's only so much left when I get back home, which caused my drive to keep learning to behave more like an on/off relationship.
Nevertheless I try to hang on to it. Having experience with developer tools as well as audio production software and hardware, I have to agree with you - people interested in programing have everything they need readily available. Sure, it got a lot easier for musicians too, but usually a decent DAW, plugins or audio interfaces and monitors still require a financial investment, which certainly helps to remind you about your original goals. Meanwhile frameworks, editors and documentation are mostly free - combined with limited time and a lack of concrete need for your new knowledge, it can be tough.
I like the company I'm working at and I'd like to contribute by taking our in-house solutions based on FileMaker to a web application. Furthermore I want those skills as a backup - in case I want (or have) to look for another job, FileMaker isn't going to impress. Also, while the music is certainly my passion, it's unlikely that I (or most other musicians for that matter) could make a living with it.
However those reasons sound rather career- and money-centric. It's not all that rational though - I like making and creating things, whether it's music, software or design - but I value doing things right and with care. Learning a "proper" language/framework and being competent with it would help a lot and I'd consider it as essential.
I'd say the greatest key to motivating someone to learn and keep learning is to have a feeling they're accomplishing something. Small projects that make it clear the person is getting somewhere and finished in a short amount of time might be the key to that. As we program longer and do much more complex projects, we tend to lose how impressive even small things are, such as building a menu on the command line or taking input from a few html boxes and spitting out a reply. To someone just learning the basics, all of that seems quite amazing I have found while tutoring a friend that was starting out programming.
Others have pointed out that making projects that are of interest to the person learning is also a key. I think combining both of those is perhaps the best solution.
I think the secret is to break down the distinction between computer operation and computer programming. If they're interested in computers and the stuff you can do with them a gentle way to get started programming is to find and use whatever scripting language whatever programs they already use have to automate stuff and make random creative hacks, rather than starting from "hello, world" and learning the fundamentals first.
For example:
Have them screw with the interface of their favorite websites: pick a greasemonkey script that already does anything on that site and change it to do something different.
Learn the macro/scripting interface of whatever productivity software they have some reason to use already and make it do something.
Find a game they like that has an active scripting or modding community, and fiddle with the game rules.
The idea is to make the mental leap that writing software is just another way of getting the computer to do what you want, and that there's one big continuum from poking buttons in a dialog box to amateur hour hacking to writing "proper" software. Eventually you'll have the ambition to do something that requires more than just plugging pieces together and making edits to stuff other people wrote, and that's when you'll be self-motivated to obtain the knowledge that will make you a more effective programmer.
I realize this is at a way more primitive level than most people think of as learning to program, but IMHO the CS 101 stuff where you learn a language and how to make simple programs from scratch is closer to the "middle" than the "beginning".
Show them how much money they can make if they stick with it. Spending a solid year and maybe a hundred bucks on books to teach yourself how to code can easily get you a higher starting wage than a lot of people with bachelor's degrees and tens of thousands in student loan debt.
They need to be intrinsically motivated or else they will be B or C players. I'm only interested in cultivating A players. It's something I can't do, and it's something that would be extremely valuable to any organization (like any company I run for instance.)
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 projects, with a code base that it's practical to read in full and understand. I've struggled with using object orientation 'correctly' in javascript. It would also be good to see a full example of how namespacing should be done properly in, say, a small website/webapp.
Gonna put this to a test: "Prerequisite: Completed at least middle school". My brother lacks 2 years to finish middle school, and I've been wanting to guess when it is a good time to start teaching him
I think different folks have different learning styles. For me books don't really help. I learn programming by programming. Often a well written blog post that I find on HN, or a tutorial that I find from google teaches me something I didn't know before. After a while you get a sense of the quality of a source... After learning like this for a few years, I started to learn a lot by reading the annotated source of libraries I use (underscore, jQuery... etc). I just wanted to throw in that I don't think books are for everyone.
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.
It seems like everybody starts out, just like I did, with "The Good Parts" only to realize that the book is much too abstract for practical purposes. With that said, there IS a reason as to why the book is so highly rated. It might not help you directly write your first JS application but it prepare the reader produce what the world really needs - good code.
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.
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).
So basically read "Professional JavaScript for Web Developers" and "JavaScript: The Definitive Guide" or is it instrumental to follow those exact steps in that order?
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/Professional-JavaScri...
(3) - Went back to "JavaScript - The Good Parts" and realized that "Professional JavaScript for Web Developers, 3rd Edition" had already covered everything in it, but explained so much more clearly.
(4) - Now I'm trying intermediate to advanced JavaScript books ("Secrets of the JavaScript Ninja", for example), and finding that "Professional JavaScript for Web Developers, 3rd Edition" covered most of their lessons, too.
The point?
If you want to learn JavaScript, (or recommend one book to someone else who wants to), whether you're an experienced programmer or not, get "Professional JavaScript for Web Developers, 3rd Edition". It's thorough and great.
Direct link to the publisher where you can get the DRM-free PDF:
http://www.wrox.com/WileyCDA/WroxTitle/Professional-JavaScri...