What is lazy initialization of objects? How do you do that and what are the advantages?
See Question&Answers more detail:osWhat is lazy initialization of objects? How do you do that and what are the advantages?
See Question&Answers more detail:osLazy Initialization is a performance optimization where you defer (potentially expensive) object creation until just before you actually need it.
One good example is to not create a database connection up front, but only just before you need to get data from the database.
The key reason for doing this is that (often) you can avoid creating the object completely if you never need it.