JavaScript Coding Standards

About six months ago a few customers asked me about coding standards when writing custom JavaScript using Microsoft’s frameworks… it turned out that we didn’t really have any publicly available standards.

To address this myself and Stuart Leeks set about coordinating and writing some standards to fill this gap. With some highly valuable input, support, and reviews from Stephen Walther, Dave Reed, Boris Rivers-Moore, and Bertrand Le Roy (thanks guys!) we’ve ended up with a set of standards and guidelines that you should find invaluable.

They are targeted at developers using the Ajax Control Toolkit and Microsoft ASP.NET Ajax Library (now part of the Ajax Control Toolkit as per Stephen’s post) but even if you’re using other frameworks you will likely get some value from reading them.

So go check out the Ajax Control Toolkit Coding Standards. To quote the introduction;

The content is split into sections that can be consumed relatively independently, to enable you to get started quickly;

·         Naming Standards is simply a set of conventions for naming JavaScript language elements.

·         Style Guidelines are preferred ways to structure and format JavaScript code.

·         Design Guidelines define recommended practices to create maintainable code.

·         Programming Guidelines specifies practices that are beneficial to the JavaScript environment, from a performance, reliability, maintainability, and compatibility point of view.


Comments (5)

  1. Brian says:

    You know what would be fantastic….a Visual Studio plugin that runs JSLint.  Visual Studio is now fast (good) enough to use for all the JavaScript that I write, but I find myself still using Aptana because of the JSLint option they have. It would be awesome to see warnings/errors popup int he Error List box in visual studio while editing a JavaScript Aptana.

  2. simonince says:

    @ Brian,

    you know, I think I saw something that did. I’ll see if I can dig it out. I agree with you though – I’ve a few ideas for JavaScript tooling in Visual Studio that I’d love the time to implement!


  3. simonince says:

    @ Brian;

    this is what I remembered;

    Note that I’m not vouching for this 🙂 I’ve never used (or even downloaded) it, but I’d be interested to hear how well it works. Certainly a great idea!


  4. As mentioned, it’s worth a read for non .NET folks.  Some good JavaScript best practices to be found.

  5. simonince says:

    @ cancel bubble;

    great to hear that, thanks.