18

I know how we start with JavaScript, we cut-and-paste a snippit to gain a little client-side functionality or validation.

But if you follow this path in trying to implement rich interactive behavior, it doesn't take long before you realize that you are creating a Big Ball Of Mud.

So what is the path towards expertise in programming the interaction layer? What books, tutorials, exercises, and processes contribute towards the ability to program robust, maintainable JavaScript?

We all know that practice is important in any endeavor, but I'm looking for a path similar to the answer here: https://stackoverflow.com/questions/2573135/

10
  • The "interaction layer?" Commented Dec 3, 2010 at 17:53
  • 1
    Should be a new tag in my opinion :P
    – Mike
    Commented Dec 3, 2010 at 18:09
  • 1
    Another question where the answer is practice just like any other field you want to master. Practice, learn from your peers (the ones who are more skilled) and did I mention practice. The process to mastering programming language x is the same as it is for programming language y which is the same as mastering sculpting or crocheting or any other trade.
    – Chris
    Commented Dec 15, 2010 at 23:05
  • 1
    @johnny: When you can snatch the exception from the stack trace...
    – TMN
    Commented Dec 16, 2010 at 13:37
  • 1
    @Chris - if you follow the link I included, you will see that such a question can be usefully answered. Saying "the answer is practice" is not helpful. Point to some landmarks along a useful path, don't just tell me to start walking. Commented Dec 16, 2010 at 14:06

9 Answers 9

15

read other peoples code (A LOT) and try to get an understanding of what they are doing, and why they are doing it. Write your own code (A LOT) try out new concepts and ideas, above all play and have fun. The best way to get better at something is to practice, practice, and then practice some more.

Read books, tutorials, articles, blogs, RSS feeds, etc.

Create some project to work on in your spare time. If you can't think of something, find an open source project you might be interested in working on.

also, don't get discouraged and above all, remember "mastery" is not a destination, but a journey--take it at your own pace, have fun, and enjoy the scenery. If you take it too seriously, you will get burnt out and that does nobody any good.

7
  • 7
    I wish this would auto answer when someone asks "how to learn/master X". Sounds a lot like how you master a mathematical proof or refine a novel. View others work of X, practice X yourself, Rinse, repeat --> Master in X.
    – Chris
    Commented Dec 3, 2010 at 18:09
  • @Chris, Yup. This is pretty much my standard answer.
    – Muad'Dib
    Commented Dec 3, 2010 at 18:39
  • Although I can say the questions regarding where to obtain good references/books/materials are questions I enjoy. Recently took on python and the question we had programmers.stackexchange.com/questions/12189/… I found to be stellar to get me off the ground and running.
    – Chris
    Commented Dec 3, 2010 at 18:55
  • @Chris yeah, this answer is more of a general advice and lacks specific steps which can be, to my mind, very objective. I, too, like to see links. But, that is what Google is for, right?
    – Muad'Dib
    Commented Dec 3, 2010 at 19:09
  • Right but google cannot provide any reaction/impression of the material. Google does good but it does not do all. Agreed regardless. t
    – Chris
    Commented Dec 3, 2010 at 19:25
9

Few links for JS mastery

3

First off, you need to know what your goal in regards to learning JavaScript is going to be. If you are just looking to do some input validation and make the UI a bit easier on the user then you really don't need to have a full in-depth understanding of the language if you are using frameworks such as jQuery.

That said, if you want to gain a solid understanding o JavaScript, then try and write an extension to an existing framework that implements a useful tool.

In terms of books and other resources, I haven't really heard of much in the way of useful books and generally I've learned the language though trying to solve problems and checking to make sure my code is clean according to JSLint. A combination of an interesting problem (e.g. framework extension), JSLint, and enough time to get some solid practice in is likely going to be your best bet in terms of learning the language.

2

Before you learn any of the web development details (DOM etc.) learn the core language. You can learn in many ways - books, videos etc. You will, of course, need to read and write code.

ECMAScript (that's the name of the language standard - javascript refers to several implementations) is a very interesting language. It is a dynamic, functional and a prototype based object oriented language, therefore, you should take your time to understand the principles of these paradigms.

Learn using an interactive console in your browser (in Chromium, you can access this by pressing Ctrl+Shift+J) which is similar to tools like IRB and the interactive Python interpreter. This is useful for testing language features and debugging.

Use JSLint to quality check your code.

When you start doing 'real' development using DHTML, make your life easier by using a framework, such as JQuery, to handle the frustrating cross browser issues.

1

A lot of the techniques which make a programmer an expert in a given language can be applied here, though javascript has a couple pearls which allow it to be used to extraordinary effect. Perhaps one of the biggest hurdles that I've had to surpass using javascript was to undo my "C" programming mentality, which is to say, a thousand tiny functions cramped into a single js file.

Some general advice is to abstract whenever you can, and try to form classes whenever you can to organize general behavior. Create new js files for any functionality which can be used to good effect in your other js files (within reason) and avoid global variables if at all possible. I would highly recommend you learn jQuery if you haven't already. It's a tool I've grown to love and now I wouldn't do without. It's an extremely flexible extension of javascript which lets you simplify your code tremendously which is good for simplicity and being able to code quickly and efficiently as well. jQuery comes with a large plugin library which allows you to do many things which couldn't be more impressive if you did it in flash. Check out jQuery UI for an entire theme system for your site, allowing you to effectively modify the entire layout of your site without doing much at all. Comes included with a lot of animation effects and handy controls commonly used on web sites (date picker, button, progress bar, etc.), most of which can be activated using a single line of javascript.

Hope that helps!

1

Much of what you do in JavaScript is essentially intertwined with DOM, CSS and browser compatibility, so understanding the DOM is one of the primary requirements to mastering JavaScript.

Learning the core features of the language, such as prototype based object orientation, anonymous functions, and more general language features such as loops, conditions etc. is the key to understanding any code that you read that isn't specifically interacting with DOM/CSS.

You will also need to learn the language standard library, e.g. the String and Math and other core object functions.

You should also study algorithms, if you wish to gain a true and complete understanding of how things are being done, and how to implement more advanced solutions, this knowledge is fundamental to understanding advanced programming, and goes beyond language specific syntax.

1

Read the code of the libraries you are using. Reading the jQuery or Prototype source will teach you oodles about what actually happens in javascript and in the dom. Research techniques that the libraries use so you can understand them. Feel free to start by reading the micro-frameworks at http://microjs.com/ . Make sure that you look at the actual source, and not just the distributed files. (jQuery has a dozen or so source files, but they are assembled by a build process.)

0

Javascript is applied in many development areas right now.

  • It's the only language present in modern browser.
  • It can run on the server, thanks to node.js and the V8 engine.
  • It can run embeded in mobile devices via PhoneGap or other alternatives.
  • It can be used to create windows 8 applications.

Therefore, I believe that there are more javascript masteries. It dependes on what you want to start with, but rest assured, each of those 4 items mentioned above will give you a different challenge - ok, maybe the window 8 and phonegap fields could be similar but the rest are different -.

If we're talking about the browser environment, learning how almost every web application should be organized could be one of the paths that you could go on. I'm going down that path, and experimenting with ideas of my own, checking out git repos of popular code organization libraries like dojo, backbone, ember etc.

If we're talking about the node js environment, that's a different story. We're not concerned with minification and file size. Creating entire applications in node, build systems, sites, REST api, there's a lot of things to discover there.

If we're talking about the mobile world, over optimization comes to mind. CSS3 accelerated properties, animations, touch events and trying to use the same architecture as the web with more specialized UI components are great things to start with.

All in all, like others responded, experimenting with your own code, and with the code of others is the best way to get involved, keep up with whats new, and who knows, maybe coming up with the next big thing.

Another thing that helps is working in a team, and understanding the differences between your way and the team's way of writing code. Working in a team of javascript developers will force you to write better code, and document it well. I think there's no better way of learning about the architecture of an application than writing a wiki about what you intend to implement or have already implemented.

-1

I hated JavaScript until I discovered jQuery. Now I love it and use it all the time. Probably too much.

2
  • You hated the DOM and cross-browser compliance not EcmaScript.
    – Raynos
    Commented Jun 9, 2011 at 17:40
  • jQuery makes Javascript fun! +1
    – Dynamic
    Commented May 12, 2012 at 20:56

Not the answer you're looking for? Browse other questions tagged or ask your own question.