Re: The wisdom of the object mentors (Was: Searching OO Associations with RDBMS Persistence Models)

From: Robert Martin <unclebob_at_objectmentor.com>
Date: Tue, 20 Jun 2006 13:26:54 -0400
Message-ID: <2006062013265413512-unclebob_at_objectmentorcom>


On 2006-06-13 13:22:40 -0400, "Marshall" <marshall.spight_at_gmail.com> said:

> Can you state what the benefit of lazy loading is?

Yes. There are two that I can think of on the spur of the moment.

  1. We don't pay for what we don't use. i.e. if some very late decision means that we don't need the data, we don't have to fetch it.
  2. Separation of context and action. It often takes a lot of work to figure out the context required to make a query. By the time we are ready to make the query we know we have all the context. However, we'd rather that the module that does the query have no idea about the context. So we use lazy loading to make sure that all the context is gathered at the point when the data is accessed.
-- 
Robert C. Martin (Uncle Bob)  | email: unclebob_at_objectmentor.com
Object Mentor Inc.            | blog:  www.butunclebob.com
The Agile Transition Experts  | web:   www.objectmentor.com
800-338-6716                  |
Received on Tue Jun 20 2006 - 19:26:54 CEST

Original text of this message