ftlabs / fruitmachine

View rendering engine
MIT License
247 stars 18 forks source link

Question about lazy vs explicit instantiation #60

Open callumlocke opened 10 years ago

callumlocke commented 10 years ago

From the docs for [Instantiation]:

Use Explicit instantiation over Lazy instantiation whenever possible.

Why? What is the downside of lazy instantiation?

matthew-andrews commented 10 years ago

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 :-)?