PDA

View Full Version : What does "lazy" mean?



bevin_b
26 Sep 2007, 1:48 AM
In many places, I meet the word "lazy render".

Could anyone tell me the meaning of "lazy" please?

I'm a newer to Ext, thanks.

evant
26 Sep 2007, 2:32 AM
In programming context, lazy generally means something isn't evaluated or rendered until it's required.

A good example is lazy evaluation:



var x = false;
var y = false;

if (x && y)
//do something


In the above case, y is never evaluated, because x is false.

Florynth
26 Sep 2007, 2:58 AM
One of the common use of the word lazy is in one of the knowed design pattern "lazy loading"

here's a small exemple.



class foo
{
protected x;

public function getX()
{
if(is_null($this->x))
{
//Do whatever to get the x value
$this->x = $x_value;
}
return $this->x;
}
}

bevin_b
26 Sep 2007, 5:32 PM
Thanks very much!:)