Modules are an integral piece of any robust application's architecture and typically help in keeping the units of code for a project both cleanly separated and organized.
Different options for implementing modules in JavaScripts are:
Different options for implementing modules in JavaScripts are:
- The Module pattern
- Object literal notation
- AMD modules
- CommonJS modules
- ECMAScript Harmony modules
Advantages of Module Patterns
- Clean
- Supports private data
Disadvantages of Module Patterns
- As we access both public and private members differently, when we wish to change visibility, we actually have to make changes to each place the member was used.
- Cannot access private members in methods that are added to the object at a later point.
- Inability to create automated unit tests for private members.
- Additional complexity when bugs require hotfixes.
No comments:
Post a Comment