I’ve recently been contributing to a set of front-end standards for Sapient, you can see the results at bp.sapient-lab.com. It’s a working document that will hopefully evolve over time.
My focus was on the organisation of JavaScript. It was a more complicated task than I’d anticipated as I couldn’t assume that our developers were all familiar with the concept of private and public variables, classes or closures.
Highlights
- Namespace your code with a closure
- Pass libraries into your closure to ensure your references
- Use the right pattern for your code, if it’s not an object don’t write it as one
- Write comments!