Skip to main content

Questions tagged [lazy-initialization]

1 vote
3 answers
211 views

I'm coding an enum strategy pattern where one of the strategies makes use of an ScheduledExecutor: class ControllerImpl { //... boolean applyStrat(StratParam param) { getStrat().apply(...
walen's user avatar
  • 355
2 votes
1 answer
1k views

In our code base, we have several static or instance members that we would like to initialize lazily. If the initialization cannot yield null, It's easy to implement. Otherwise, one could use an ...
mperktold's user avatar
  • 151
2 votes
1 answer
142 views

Assume we want to model a table where players can sit down to get together to play a game (card games, dice games, ...). Assume a few properties associated with each seat class Seat { public int ...
Benj's user avatar
  • 169
1 vote
2 answers
518 views

A couple of months ago I wrote a C++ program for computational mathematics that was supposed to compete with a highly optimized C code. After a while I did manage to get it fast enough to beat the C ...
mathreadler's user avatar
6 votes
1 answer
1k views

I have heard some people claiming that boolean state variables are generally bad and should be avoided when possible. Apparently in many cases it is possible to put state into lambda functions, ...
Michael Veksler's user avatar
0 votes
1 answer
212 views

Haskell is one of the few non-strict languages out there. In his paper Why Functional Programming Matters, John Hughes uses (memoized) lazy evaluation (as well as higher-order functions) to implement ...
Qqwy's user avatar
  • 4,947
4 votes
1 answer
1k views

Background I am trying to develop with Webpack and JavaScript. Webpack would bundle all source code into one single file. When application becomes large, the file would be very large and cause ...
Ben Cheng's user avatar
  • 349
8 votes
1 answer
1k views

Definition of the lazy loading pattern from Wikipedia: Lazy loading is a design pattern commonly used in computer programming to defer initialization of an object until the point at which it is ...
R Sahu's user avatar
  • 2,016

15 30 50 per page