The lazy-initialization tag has no wiki summary.
2
votes
1answer
81 views
Applying initialization-on-demand holder idiom at variable level rather than class
I was looking for the idiomatic way to implement thread-safe lazy initialization for a configuration collection retrieved from the DB inside a Spring bean.
I decided to adapt the ...
0
votes
1answer
76 views
Does a create() method exist as part of a pattern? [closed]
Is there something special(i.e. a design pattern being related) to a method named create()?
Background
The case is, I often make some instances of objects (of the same class/prototype). These ...
6
votes
2answers
656 views
Does laziness yield more race conditions?
I recently ran into a race condition while accessing a configuration setting. After examining what I could of the code, I came to the conclusion that the Configuration class' laziness1 was the source ...
-1
votes
2answers
121 views
Is 'lazy' the correct term for timestamp-based skipping? [closed]
(1)
The oldmakeutility looks at timestamps, and if the output is newer than the input, it skips (pointless, time-consuming) re-compilation of e.g. C files.
The same is true for many languages and ...
0
votes
1answer
129 views
Lazy-initialization vs preprocessing in image-based iOS app
I am making an iOS app which contains museum gallery: user can look through exhibits and then select info about it, etc.
On the exhibit screen I have two ScrollViews that are different, but are being ...
2
votes
0answers
554 views
Entity Framework - Loading Related Entities Explicitly
I have been using Entity Framework for a few years. I have flip-flopped between calling out to repositories in my business logic or using lazy loading to retrieve data as I work my way through the ...
0
votes
0answers
106 views
Succinct Lazy Initialization Pattern
Background
I often use the following lazy initialization pattern:
public class Clazz {
private Object object;
private Object getObject() {
Object object = this.object;
if( object == ...
2
votes
2answers
234 views
Lazy loading if collection would have any entries
I often see model classes with properties like this:
public IList<Note> Notes { get; set; }
public bool HasNotes { get; set; }
Where the list is initialized lazy, but the boolean property is ...
2
votes
1answer
443 views
Why does this static field always get initialized over-eagerly?
I am looking at this excellent article from Jon Skeet.
While executing the demo code, Jon Skeet says that we can expect three different kinds of behaviours. To quote that article:
The runtime ...
3
votes
1answer
561 views
Lazy loading can lead to stale data, violates IoC?
Trying to be a better programmer
I have an application that keeps track of Roles and Permissions, I had classes for Role and Permission which were just value objects.
class Role
{
int RoleID
...
14
votes
4answers
4k views
Why isn't lazy evaluation used everywhere?
I've just learnt how lazy evaluation works and I was wondering: why isn't lazy evaluation applied in every software currently produced? Why still using eager evaluation?
5
votes
4answers
1k views
What is a good pattern for combined caching and reinitialization?
I have a situation where I have three requirements:
Lazy initialization - don't create the collection until asked for it
Caching - keep the collection in memory on the object
Reinitialization - be ...
9
votes
4answers
1k views
Is there any reason lazy initialization couldn't be built into Java?
Since I'm working on a server with absolutely no non-persisted state for users, every User-related object we have is rolled out on every request.
Consequently I often find myself doing lazy ...
1
vote
1answer
360 views
WPF: Reloading app parts to handle persistence as well as memory management
I created a app using Microsoft's WPF. It mostly handles data reading and input as well as associating relations between data within specific parameters.
As a total beginner I made some bad design ...