Reducing the loading time of a web application is a well known problem. Developers need to make sure the browser only downloads the code that is strictly necessary to bootstrap the application and leave the rest for later. This is what we commonly call lazy loading.
But when is later? When is the right time to lazy load?
When users interact with our applications there is a good chance they won't use all the provided features. Why lazy load code that is not needed then? Front-end code can be logically split into 3 sets:
Code required to bootstrap.
Code needed for the core functionality. It should be lazy loaded as soon as the bootstrap code has been delivered and parsed.
Code that may not even be necessary, or that is required only when a particular feature is used, and is therefore strictly dependent on the actions users perform within the context of the application. This means that this code can/should be loaded on demand.
Video here: http://www.ustream.tv/recorded/25243564