---restore content starts---
Module mode: A way to provide private and public encapsulation of classes in traditional software engineering.
In JS: Module mode uses closures to encapsulate private state and organization. This mode returns a public API, while everything else remains in the private closure.
Since JS does not have access modifiers, we cannot call variables public or private, so we need to use function scopes to simulate this concept.
Advantages of using module mode:
1) Only our modules can enjoy the freedom to have private functions.
2) The discovery of function anomalies becomes much easier.
3) more tidy.
4) Support private data.
Disadvantages:
1) Change the visibility of the member and need to change every place where the member has been used.
Reveal mode:
Returns an anonymous object that has a pointer to a private function.
Pros: Make scripting syntax consistent and easy to point out which functions and variables can be accessed publicly.
Cons: If a private function refers to a public function, the public function cannot be overwritten when patching.
Module mode and reveal mode.