Freigeben über


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.

Enjoy!

Comments

  • Anonymous
    May 10, 2010
    The comment has been removed

  • Anonymous
    May 10, 2010
    @ 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! Simon

  • Anonymous
    May 10, 2010
    @ Brian; this is what I remembered; http://jslint.codeplex.com/ 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! Simon

  • Anonymous
    May 13, 2010
    As mentioned, it's worth a read for non .NET folks.  Some good JavaScript best practices to be found.

  • Anonymous
    May 13, 2010
    @ cancel bubble; great to hear that, thanks. Simon