Everyone Starts Somewhere
The web community is different from many other programming communities because so many of its members are not formally trained. Most people don't get a degree in web development, and certainly not an advanced degree. Many of us got into this field because we were interested in the communication possibilities of the web, not because we wanted to become coders. If, along the way, we have managed to turn this into a discipline and a trade, it's not for lack of missteps and mistakes.
The result of this amateurization is that web development is riddled with misinformation and hearsay. Copy and paste code makes its way around the Internet in a flash, and inexperienced developers are happy to use it without understanding how it works. The proliferation of jQuery plugins did not help with this--nor, to be fair, did the often-confusing world of browser compatibility and bugs, which made building web pages that worked in both IE6 and Firefox 3 (to date myself) an act of voodoo as much as it was skill. Luckily, these kinds of inconsistencies are increasingly rare.
As an instructor, it's easy enough for me to tell students "don't use W3Schools" and "write your own plugins." It is somewhat harder to say which resources web developers should use when they're first starting out, or how they can distinguish between trustworthy and untrustworthy advice. Online guides are often written from an assumption of either no experience or vast expertise on the part of the reader--this leads to what a friend of mine calls "the cliff," where moving beyond the basics immediately throws a student into the deep end, to either sink or swim.
To be fair, reading documentation and evaluating resources is a fundamental skill for programming, and it is much more difficult to write a guide that covers this middle ground of experience. In this chapter, we'll try to cross that divide, not with detailed instructions, but by providing a list of trustworthy resources, as well as some rules of thumb you may find useful when searching for solutions to your coding problems.
Trust No-one Someone
Okay: say you've promised not to visit the W3Schools or ExpertsExchange. Where does that leave us? What are the trustworthy destinations for information about web programming?
- Mozilla Developer Network: Powered by the people who head development of Firefox, MDN should be your first stop for information about JavaScript. It is a frequently updated, accurate, and well-organized reference to the mechanics of the browser. Historically, it has been weakest when it comes to tutorials, but that's changing (due to both on-site tutorials and more external links). If I need information about a specific part of JavaScript, I'll often search the web for "mdn [topic here]" to make sure the top result is from Mozilla.
- Web Platform: A new community site developed in cooperation with leading tech companies (including Microsoft, Google, Mozilla, and Adobe), Web Platform is a bit more "tutorial friendly" compared to MDN. It is still in alpha, meaning that many pages are "stubs" without any information on them, but what is there should be reliable and practical.
- HTML5 Please and Can I Use: These sites exist to give the latest information on browser compatibility and features. HTML5 Please favors information on shims and polyfills that can be used to take advantage of these features in older browsers, while Can I Use has comprehensive tables on browser support (including partial support for specs that are still under development).
- Stack Overflow: Created to fight the content farms that were cluttering up search results for technical questions, Stack Overflow is definitely better than the sites it replaced. On the other hand, it's a community site with a large audience, which means that it may be vulnerable to hearsay and inexpert commentary. Use, but sparingly.
Choosing Wisely
Often times, even with all the resources above, you won't be able to find information on the solution to your problem. At that point, a search engine will point you toward plenty of advice, but how do you know whether it's any good? Evaluating quality is a tough skill to learn--one that most programmers develop, but can't break down into a real process. It is probably not any comfort to know that you'll be able to distinguish good from bad in a few years. How do you tell the difference now? Here are a few rules of thumb that may be handy.
- Don't use code you don't understand. Specifically, don't try to adapt code you don't understand--it's okay to use libraries like jQuery or Underscore that are beyond your current grasp. That doesn't mean you can't use other people's code, but it means that you should dig in and try to understand everything you use. Once you've got a grip on what it does, then you can use it for your own purposes.
- Don't copy and paste from someone's site, ever. You can't learn anything by copy and paste, and you'll find it hard to make patchwork scripts built this way work together. Take the time and retype anything you use, adapting it for your own use.
- Read other people's source code. One of the greatest side-effects of the Internet is the triumph of open-source software. Not only does this give us tools like web servers, browsers, and editors, it also provides all kinds of opportunities to learn from other people. There are countless JavaScript projects available for you to look through to see how the best JavaScript programmers in the world write their code: jQuery, YUI, and Twitter Bootstrap are all open-source and easy to browse, just to start. Paul Irish also has a couple of valuable videos on things he's learned by reading the jQuery source. Reading code may never take the place of a good book, but it's surprisingly educational.
- Get a second opinion. As a former journalist, I always remember the newsroom maxim: "If your mother tells you she loves you, believe her--but check it out." Don't accept anything at face value, without looking to see if you can find other people agreeing or disagreeing with it.
- Consider the source. There's a logical fallacy that says we should consider the argument, not the person making it. That's true, as far as it goes--but credentials count. Before accepting advice from the Internet, ask yourself: Is the author a programmer with projects to their name, or are they just a random person with a blog or a message board account? Is their site well-made? Have they contributed to open-source projects, and if so, which ones? You wouldn't take advice from strangers on the street, so don't do the equivalent on the Internet.
- Ask a friend--and remember, you have many friends you didn't even know you had. Because so many of us are self-taught, the web community is full of helpful people. Companies like Google and Mozilla even pay "developer relations" staff to serve as useful community resources. Take advantage of that, and don't ever be afraid to ask for more information.