Keep reading for FREE
Good authors divide their books into chapters and sections; good programmers divide their programs into modules.
Like a book chapter, modules are just clusters of words (or code, as the case may be).
There are a lot of benefits to using modules in favor of a sprawling, interdependent codebase.
The Module pattern is used to mimic the concept of classes so that we can store both public and private methods and variables inside a single object — similar to how classes are used in other programming languages like Java or Python.
That allows us to create a public-facing API for the methods that we want to expose to the world, while still encapsulating private variables and methods in a closure scope.
For projects that require you to support both AMD and CommonJS features, there’s yet another format: Universal Module Definition (UMD).
UMD essentially creates a way to use either of the two, while also supporting the global variable definition. As a result, UMD modules are capable of working on both client and server.
reading habits, gather your
remember what you readand stay ahead of the crowd!
Save time with daily digests
No ads, all content is free
Save ideas & add your own
Get access to the mobile app
4.7 App Rating
Engineer in control and instrumentation
MORE LIKE THIS
As I strive to become a better python programmer, I’ve started using type hints and created this intro guide