Javascript revealing module pattern disadvantages
I have been reading about revealing module pattern
in Addy Osmani's book. It highlights following disadvantage:
A disadvantage of this pattern is that if a private function refers to a public function, that public function can't be overridden if a patch is necessary. This is because the private function will continue to refer to the private implementation and the pattern doesn't apply to public members, only to functions.
Public object members which refer to private variables are also subject to the no-patch rule notes above.
As a result of this, modules created with the Revealing Module pattern may be more fragile than those created with the original Module pattern, so care should be taken during usage.
I'm not an expert in JS and it is not making much sense to me. Also book doesn't provide any examples of these disadvantage comparing to module pattern .
I googled and found this on here:
Revealing module pattern disadvantages
which again I'm not able to grasp. As examples being used are using constructor functions.
Could someone please ELI5 please.
链接地址: http://www.djcxy.com/p/50134.html上一篇: 模块模式对象是否可以从构造模式对象继承?
下一篇: JavaScript揭示模块模式的缺点