The Problems
  • No coding standard or guidelines
  • Not interested area
  • Lack of knowledge of jQuery and JavaScript standard
  • Not maintainable, reusable
  • Duplication of codes
  • No Caching
  • Not Secured (Not minified)
What are modules?

In JavaScript, the word “modules” refers to small units of independent, reusable code.

Why use modules?
  • Maintainability
  • Namespaces
  • Reusability
Anonymous closure
Anonymous closure
Static namespace
Anonymous closure
Module pattern
Anonymous closure
Revealing Module Pattern
Anonymous closure
Namespacing
Anonymous closure
Multiple modules with common namespace
Anonymous closure
Module injections
Anonymous closure
Other Design Patterns
  • Prototype
  • Observer
  • Singleton
Module Design Pattern Library
  • CommonJS
  • AMD (Asynchronous Module Definition)
  • UMD (Universal Module Definition)