event plugin system

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: event plugin system

Post by Chris Corbyn »

josh wrote:Its actually different then AOP from my understanding, doesn't AOP "mix" code statically? Whereas events are dynamic, meaning that they can change during runtime without having to generate / weave code?
Yeah AOP allows you to define cutpoints that effectively allow injection of code statically. It requires significant modification to the runtime environment which is why I think it's a bit of a hack. AOP is very much an experimental concept at the moment and while it may find it footing over time, it has a lot of potential problems right now... moreso in threaded environments.

AspectJ is probably the most well documented AOP language, adding Aspect features to Java.
josh
DevNet Master
Posts: 4872
Joined: Wed Feb 11, 2004 3:23 pm
Location: Palm beach, Florida

Re: event plugin system

Post by josh »

Yeah, based off the little I know it sounds like there's nothing it can do you can't do with a little template method calling at runtime
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: event plugin system

Post by Chris Corbyn »

josh wrote:Yeah, based off the little I know it sounds like there's nothing it can do you can't do with a little template method calling at runtime
Actually, AOP adds features to languages that solve some problems with other programming paradigms. It tries to deal with the issue of large amounts of code that have to do things in common and get easily tangled/coupled, even with OOP. It's more than just a bit of syntactic sugar but in my opinion it's experimental and hasn't got particularly widespread adoption. It allows you do more cleanly solve problems surrounding crosscutting concerns, such as things like the events system being discussed here (where various parts of the system are integrated with it) or something like logging.

It's a new paradigm, though not quite as hard to grasp as the difference between procedural/OOP.

If you know Java, this will probably make a lot of sense:

http://en.wikipedia.org/wiki/Aspect-ori ... rogramming
http://www.eclipse.org/aspectj/
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: event plugin system

Post by Christopher »

Chris Corbyn wrote:It allows you do more cleanly solve problems surrounding crosscutting concerns, such as things like the events system being discussed here (where various parts of the system are integrated with it) or something like logging.
I think it hasn't caught on because the problems it solved have since been solved in ways that don't need language add-ons -- such as Inversion of Control / Dependency Injection. There is even this new move toward Annotations which are simplified Aspects. But that has not really taken off either.

I think it ends up that the best thing to do with cross-cutting concerns is not to modularize them, but to simplify them out of existence by implementing them using the tools at hand, such as framework features.
(#10850)
Post Reply