mardi 31 octobre 2017

Describe the oft quoted disadvantage of Revealing Module Pattern with an example

I read Javascript Design Patterns, and then a bunch of SO answers on RMP, and I keep finding that where disadvantage is mentioned, it's the straight up quote from the book:

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 that refer to private variables are also subject to the no-patch rule.

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.

Sorry that I'm stupid but the above explanation just isn't doing it for me. Can someone provide a code-rich visual example of what that disadvantage means?

Aucun commentaire:

Enregistrer un commentaire