Best practices and troubleshooting

In an ideal world, everybody would get to work on greenfield projects, where they can put in standards right from the get go. However, that isn't the case. Frequently, you may find yourself in a situation where you have a bunch of non-modular JavaScript code as part of a legacy system.

In these situations, it may be advantageous to simply ignore the non-modular code until there is an actual need to upgrade it. Despite the popularity of JavaScript, much of the tooling for JavaScript is still immature, making it difficult to rely on a compiler to find errors introduced by JavaScript refactoring. Automatic refactoring tools are also complicated by the dynamic nature of JavaScript. However, for new code, proper use ...

Get Mastering JavaScript Design Patterns now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.