Test-Driven JavaScript Development (Developer's Library)
Rate it:
7%
Flag icon
Unit tests should test software components in isolation. They should also run isolated—no test should ever depend on another test, tests should be able to run simultaneously and in any order.
30%
Flag icon
This approach has a serious drawback in that it creates three function objects for every person object created. The original approach using a closure when adding properties to the prototype will only ever create three function objects that are shared between all circle objects. This means that creating n circle objects will cause the latter version to use approximately n times as much memory as the original suggestion. Additionally, object creation will be significantly slower because the constructor has to create the function objects as well. On the other hand, property resolution is quicker ...more
Carl-Erik Kopseng
notes on Crockfords module pattern
31%
Flag icon
The functional style is an interesting alternative to the pseudo-classical constructors, but comes with its own limitations. The two most obvious drawbacks of this style of coding are that every object keeps its own copy of every function, increasing memory usage, and that in practice we aren’t using the prototype chain, which means more cruft when we want to call the “super” function or something similar.
Carl-Erik Kopseng
drawbacks of the Module pattern / functional inheritance