|
Val's Blog
Lots of stuff for Web 2.0 freaks and Javaholics
|
|
|
Albert Einstein: "We cannot solve our problems with the same thinking we used when we created them." |
[ Login ] |
|
Yesterday, I read Devx's article on Java Dynamic Proxies and how they can help you achieve AOP. This morning Sam Newman is commenting that Dynamic Proxies and AOP are two completely different things. I partly agree with Sam's comments. Although, I would like to elaborate a little bit on why Devx's article is not that far off the truth. The author might not have found the proper words for communicating her thoughts, but this is another debate.
In order to understand why Sam's statements are neither completely true nor wrong, it helps to know what the fundamentals of AOP are. Basically, the AOP paradigm mandates the following three main concepts:
Any respectable AOP framework should provide concrete means for implementing those concepts. For instance, AspectJ realizes those concepts with, respectively, the pointcut/advice constructs, the introduction mechanism and the aspect construct. AspectWerkz provides a 100% Java AOP solution with normal methods (+ attributes The fact that AspectJ doesn't use dynamic proxies doesn't mean that dynamic proxies have nothing to do with AOP as implied by Sam. AspectJ is just an AOP implementation that happens to be somehow one of the most famous and most supported implementation out there. Too many people think that the equation "AspectJ = AOP" yields true, which is just plain wrong since they are conceptually at two different levels. It is my opinion indeed that the AOP paradigm somehow "suffers" from AspectJ's view of AOP and that when people talk of aspects they somehow unconsciously think of it in the AspectJ sense, which might not be AspectJ's fault of course but more a problem of how it has been and is being marketed. Moreover, the fact that dynamic proxies have been around before the AOP paradigm itself doesn't mean that dynamic proxies have nothing to do with AOP either. Similarly, the wheel has not been invented for cars exclusively and the notion of a wheel has nothing to do with the notion of a car. Car constructors have just identified the wheel as an ideal existing solution element for moving cars around. Again, dynamic proxies are one solution that existed at the time AOP people needed to implement certain AOP concepts and that's all! To sum up, please do not mix up things whose roots and foundations lie at different levels. In clear, compare what is comparable.
TrackBacks[0]
Comments[1]
Posted by val on July 14, 2004 10:10:14 AM CEST
Reply |
Permalink
Re: Dynamic Proxies != AOP? It doesn't hold!!
I was perhaps not clear enough in my post - the thrust of what I was saying was that just because you understand dynamic proxies does not mean you understand AOP. Its like people saying that because they understand remoting they understand enterprise architecture.
An understanding of what proxies are and what they can achieve (which the article was very good at explaining) can impart some feeling for what benifits AOP has, but it really is only a part of the whole. Concentrating on this one aspect (which taken on its own is not AOP) can result in people thinking they are "doing AOP" where all they are doing is interception, and can also lead people into thinking they understand AOP when they really don't - few technologies out there will punish a naive developer more quickly that AOP!
On a seperate note, can AspectWerkz perform field-level interception without the use of getters/setters? My understanding was that without a non-standard JVM or compile-time sourcecode/bytecode manipulation such interception was not possible...
Comment from Sam Newman on July 14, 2004 10:56:40 AM CEST
TrackBack to http://radio.javaranch.com/val/addTrackBack.action?entry=1089792614000
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Content © Val | Powered by Pebble 1.9.1 |