This post originated from an RSS feed registered with PHP Buzz
by Sebastian Bergmann.
Original Post: More on AspectPHP
Feed Title: Sebastian Bergmann
Feed URL: http://sebastian-bergmann.de/
Feed Description: Geek by nature, PHP by choice.
As I mentioned in my initial blog entry on AspectPHP I currently lack the time to really work on it. What little time I have I rather invest in hacking than in documenting.
AspectPHP currently works similar to what is described here. To work on the AspectPHP runtime, which includes coming up with a "language" to define joinpoints and pointcuts, I need a working prototype. PHP 5's __call(), __get(), and __set() interceptors give me exactly that in the form of "dynamic weaving".
"Dynamic Weaving" means that the sourcecode of every class needs to be transformed to extend a proxy class (AspectPHP_Runtime_Object) that implements the interceptor methods and forwards attribute accesses and method calls to the aspect dispatcher (AspectPHP_Runtime_Registry). This sourcecode transformation can be performed in advance (using a Phing task) or at runtime (using an __autoload()-based classloader).
During the development of AspectPHP I can live with the performance penalty this approach imposes (a benchmark shows a 200% penalty for object attribute access and a 600% penalty for method calls with PHP 5.1.0-CVS).
Once the development on the AspectPHP Runtime has come to a certain point I will implement "static weaving" which transforms the sourcecode to use the aspects directly without the need for a proxy class.