News Feed

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

Imagine Easy:
Pushing the limits of metaprogramming in PHP aspect oriented design
February 20, 2014 @ 12:01:05

In a new post to the "imagine easy" blog Yitzchak Schaffer looks at Aspect Oriented Programming in PHP and pushing the limits of some of the work already done in the area.

Here's the premise [of Aspect Oriented Programming]. A given piece of code exists for a certain purpose - let's say, to retrieve a record from a database. But there may be any number of other things that need to happen in addition to the actual retrieval: logging, access control, caching… those are known as cross-cutting concerns - issues that are relevant across the codebase, but are not specifically relevant to any one piece of code where they might be needed. And being that these bits of functionality are not intrinsically connected with data retrieval, in our example, it would make sense for them to be disconnected from the retrieval implementation.

He includes some example code showing the migration from a typical logging example, moving the logging code away from the other parts and into an "aspect". He briefly mentions some caching functionality and talks about how one PHP framework, Lithium, makes use of these kinds of AOP principles. He offers an alternative in the form of subtypes, and example of which he's implemented in a tool of his own, Camphor.

0 comments voice your opinion now!
aop aspectoriented design metaprogramming example introduction


blog comments powered by Disqus

Similar Posts What’s New in PHP 5.5 Using Satis for fast and reliable software deployment

Zend Developer Zone: Refactoring PHP Code

Zend Developer Zone: Introduction to DataModeler

Box UK: Unboxing: Silex

Community Events

Don't see your event here?
Let us know!

series laravel5 opinion introduction community voicesoftheelephpant language laravel unittest security framework api podcast interview extension release development library version php7

All content copyright, 2015 :: - Powered by the Solar PHP Framework