When we discussed the singleton pattern we mentioned that


Question: When we discussed the Singleton pattern, we mentioned that lazy evaluation is sometimes useful for putting off the creation of an object until it is needed. The same lazy evaluation process is also useful during initialization of other kinds of objects. That is, instead of initializing all its instance variables of an object during construction, some of them can be initialized to null or some other invalid default value until they are first needed at which point they can be properly initialized.

a. What are the advantages of lazy initialization?

b. What are the disadvantages of lazy initialization?

c. Why would you not want to make publicly available instance variables that are initialized lazily?

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: When we discussed the singleton pattern we mentioned that
Reference No:- TGS02580274

Expected delivery within 24 Hours