-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
.prototype #1150
Comments
The main reason for using the module pattern is that I find it less readable to read code constantly refering to Its slightly less performant but only if you are recreating the object a lot of time which is a fairly special case for our tests, not much reason for users code to do that. If theres a proposal thats cleaner than the alternative then down for checking it out, in theory I would expect a full switch to .prototype to be less readable though |
I agree with you @nick-thompson, though actually doing it is the hard part. @daleharvey while this. can be confusing, at the moment our solution is not much better. for instance use of this would allow us to further modulerize the code e.g. break up It actually might not be that hard, changing this line to |
I'll take a stab at rewriting the leveldb adapter to conform to this proposal and we can carry on this discussion in the context of actual code, sound good? I'll probably get to it some time tomorrow or Tuesday. Also, I'm working on writing up some thoughts about how we can minimize the amount of code an adapter actually requires, so perhaps I'll include those thoughts in my example rewrite and we can hash both things out at once. |
fyi the map reduce plugin uses prototype |
Agree with @nick-thompson on the problem of grokking code given multiple levels of nested callbacks in the absence of any design documents at all, especially statecharts. This seems certain to negatively affect implementation of correct behaviour. |
Done |
None of our constructors use
.prototype
, and I'm not really sure why. For one, this is a pretty big performance hit for any application using several databases (i.e. our test suite?). For two, there's a lot of poorly written, nested functions within constructors for the sake of closed variables that makes reading/understanding the files so much harder than it needs to be (sorry if I'm being harsh, but theLevelPouch
constructor in our leveldb adapter is... the entire file).Want to back this issue? Place a bounty on it! We accept bounties via Bountysource.
The text was updated successfully, but these errors were encountered: