How to Learn JavaScript Properly
javascriptissexy.com
javascriptissexy.com
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...
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?
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.
$addOne = function($a){ return $a + 1 };
$result = array_map($addOne, array(1,2,3)); // now [2,3,4]
Or: // Reference to intval() function.
$result = array_map(intval, array('1','2','a'));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.
And now I'm sure someone will respond saying that they found Stroustrup's book remarkably straightforward. To each his own I suppose.
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.
http://www.amazon.com/review/R31YJRU8MO6FD4/ref=cm_cr_dp_tit...
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?
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.
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.
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".
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.
We're making it really easy and fun for beginners, and we provide help and feedback on all of your code from expert tutors.
Check out some of our demos at http://codehs.com/demos (most of them work on your phone as well) to see what you'll learn to make.
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.
Any suggestion would be very much appreciated.
https://developer.mozilla.org/en-US/docs/JavaScript/A_re-int...
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.
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).