On Sunday, March 24, 2013 3:09:43 AM UTC+1, Rick Waldron wrote: > > > On Sat, Mar 23, 2013 at 9:26 PM, Nabeel S. <[email protected]<javascript:> > > wrote: > >> Thanks for all the feedback guys, still trying to learn all the >> intricacies of the module system, and just the best patterns to use. I >> remember reading somewhere (I'll have to dig it up, though Crockford comes >> to mind), that the the "createLogger()" type of pattern is the preferred >> one. >> > > I don't have empirical data to back this claim, but I strongly doubt that > this is preferred. As far as I'm concerned, a factory that does nothing but > wrap instantiation is a bug. >
Yep, Crockford. Although it's more accurate to say that he's just not recommending **plain** constructors. Qutoing (Javascript the Good Parts; page 30): >>> Functions that are intended to be used with the new prefix are called constructors. By convention, they are kept in variables with a capitalized name. If a constructor is called without the new prefix, very bad things can happen without a compile-time or runtime warning, so the capitalization convention is really important. Use of this style of constructor functions is not recommended. <<< -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
