For page resources, lazy initialization delays retrieving images, video, or other assets until they are needed. For example, an image near the bottom of a long page can wait until the user scrolls toward it, reducing transferred data and network traffic. section 8.4.4
Lazy initialization
A resource-loading technique that defers retrieval until a resource is likely to be needed.
How The Art of Code covers it
- How deep it goes
- Describes the goal and a scrolling example without specifying an implementation.
- Examples
- Uses images near the bottom of a long page as assets that can wait until the user scrolls toward them.
- What you can do after
- Apply it by delaying retrieval of images, video, and other assets until they are needed.
- How it connects
- Connects static assets with bandwidth use, network conditions, and device capabilities.
Also explained in
-
Java Persistence with Spring Data and Hibernate epubFetchType.LAZY is a Jakarta Persistence fetch option indicating that an associated value should be retrieved on demand when supported by the persistence provider.
-
Machine Learning Platform EngineeringLazy initialization is a pattern that postpones expensive resource creation or setup until the resource is first needed.
-
Python How-ToA lazy attribute is an attribute whose value is computed only when the attribute is accessed rather than when its object is initialized.
-
C++ Concurrency in Action, Second EditionLazy initialization is a technique that delays constructing or initializing a resource until it is first required.
Compare how 5 books explain lazy initialization →
Related concepts
- eager loadingcontrasts with · Eager loading is a data-loading strategy that retrieves required data before it is requested individually, often fetching related data together with its primary entity.
- N + 1 query problemproduces · The N+1 query problem is an inefficient data-access pattern in which one query retrieves a collection and a separate additional query retrieves related data for each item.
- Angular moduleuses · An Angular module is an NgModule-based application unit that groups and configures declarations, imports, providers, and exports.
- Singleton patternused by · The Singleton pattern restricts a type or component to one shared instance within a defined scope and provides a way to access that instance.
This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.




