In theory I know what Aspect-Oriented-Programing (AOP) is. In practice I have never used AOP! (AspectJ, AspectWerkz nor any other AOP framework). Nevertheless I am going to go out on a limb and make a bold statement. AspectJ is way better then AspectWerkz! I would love to hear about any anecdotal evidence which can support or refute my claim. So why do I think so?
My hypothesis is: AspectJ was written with tests and hence is written in a more testable manner. Over time the advantage of test was that the code base was more malleable and hence AspectJ ended up with more features and so has won the AOP war.
Why am I picking on AspectJ vs AspectWerkz? Well because they are two projects with identical goals but very different outcomes. As such I think we can compare them and learn from their differences.
AspectJ is more testable then AspectWerkz. How hard would it be to write a unit-test for any one of the classes in AspectJ or AspectWerkz? Look at the graph below and you will see that AspecttWerkz has all of the dots above the score of 2000 in testability-cost. While in AspectJ case all dots are below 2000 (and to the right) in testability-score. The simples way to think about the scores is that to write a unit-tests for AspectWerkz I would encounter an average of 5000 IFs per unit-test. While I would encounter about 1800 IFs per unit test in AspectJ. The AspectJ test would be a lot more focused (closer to unit-tests) then AspectWerkz test would be. It also means that a failure in AspectJ will be easier to diagnose since the tests are a lot smaller.
Is it not true that any large application becomes hard to test? Well look at the final size of the JAR or the number of classes in the JAR. As you can see AspectJ has a lot more of both. Hence I would assume that it has a lot more features as well. If all large applications would be hard to test we would expect a linear relationship between size and testability-cost. Something which we do not see in the graph bellow.
[kml_flashembed movie="http://www.testabilityexplorer.org/flex/TestabilityCharts.swf" height="450" width="450" fvars="data=http://www.testabilityexplorer.org/flex/projectInfo.csv&filter=aspectj/;aspectwerkz/.swf" /]
How do you know your hypothesis is right? I don’t know since I have never used either product hence I don’t know how hard would it be to use it or how many bugs I would encounter. But simple search on Google reveals that AspectJ is a lot more popular.
– Miško Hevery