benbria / object-spy

0 stars 0 forks source link

Prototype observation store #17

Closed ghost closed 9 years ago

ghost commented 9 years ago

Add ObservationStoreManager methods to the prototype so the code is shared among all instances, which should be more efficient.

Testing Performed

bllanos commented 9 years ago

Looks good to me. Technically, the ObservationStore class suffers from the same problem.

However, I remember why I originally constructed the classes in their original fashion: It limits the publicly accessible interface of the class objects. When functions are moved to the prototype from class instances, the functions need to be rewritten to use @attribute notation to refer to instance data, which means that the instance data must now be publicly accessible. (Perhaps there is some way to create only one copy of each class method, but still have private data, which I am not aware of?)

It's up to you @bsleighb if you want to change it or not.

ghost commented 9 years ago

After discussing this issue with Bernard (@bllanos), we agreed on using underscores to denote privacy (for now, at least).