ftlabs/fruitmachine

Question about lazy vs explicit instantiation

callumlocke opened this issue · 1 comments

From the docs for [Instantiation]:

Use Explicit instantiation over Lazy instantiation whenever possible.

Why? What is the downside of lazy instantiation?

I believe this to be a coding style question. We use both approaches on a case by case basis within the web app. It makes no difference to what actually gets executed as the lazy approach will instantiatd fruitmachine module on your behalf:
https://github.com/ftlabs/fruitmachine/blob/master/lib/fruitmachine.js#L46.

Maybe we could consider making the documentation more neutral @wilsonpage :-)?