Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Zend:
Getting Lazy with Initialization
Aug 12, 2003 @ 12:13:48

In the next article in their "Intro to PHP5" series, Zend has posted their latest - Introduction to Interceptors II: Implementing Lazy Initialization.

This piece introduces the idea of "aggregation" into a class environment. Basically, whenever a class stores a reference to an object of another class in one of its attributes is said to aggregate that object. Not an easy concept to grasp without some examples, but, thankfully, they're not short on them. They give you plenty of examples on how to use this idea, as well as how to use the _get() function to eliminate the overhead of aggregating another class.

It's a short introduction to the ideas of "lazy initialization" and "aggregation", but it's good to see how to use some of these new advancements in PHP5 before they are released to the public. This and other OOP features will change the way a lot of code is written in the future - hopefully for the better...

tagged:

Link:


Trending Topics: