Unit Test Your Aspects 130
An anonymous reader writes "The widespread adoption of programmer testing over the past five years has been driven by the demonstrable productivity and quality of the resulting code. Find out why and how to do it, as this article introduces you to the benefits of testing aspect-oriented code and presents a catalog of patterns for testing crosscutting behavior in AspectJ."
Less time for proper testing (Score:5, Interesting)
Re:Unit Testing In The Schools... (Score:5, Interesting)
I've recently been working on a BlueJ extension for PMD [blogs.com] and he's quite active on the bluej-discuss list.
Aspect-oriented? (Score:3, Interesting)
wtf is Aspect-oriented programming?
how does it relate to object-oriented programming?
Re:Aspect-oriented? (Score:5, Interesting)
The promise of this is that you can save some effort by reducing repetitive function calls. The risk is that control flow can be very difficult to trace. Some people argue that aspect-oriented programming is similar to programming with goto, and I'm inclined to agree with them. It's useful under certain tightly defined circumstances and harmful otherwise.
Re:Less time for proper testing (Score:3, Interesting)
- You are now familiar with the functionality of that piece of code, so writing a test should be easy.
- Having a test ensures that no future code changes will cause the same bug (it is very embarassing to re-introduce a fixed bug).
- Having a test also ensures that other code changes don't affect anything related to this functionality working. This can also help uncover unnecessary coupling - when this testcase fails in the future because something seemingly unrelated changed, you can investigate what is really going on because you will be alerted to it much sooner.
Re:Is this statement a joke? (Score:3, Interesting)
Reminds me of a study done on Taxi cabs in San Fransisco shortly after ABS (Antilock Braking Systems) came out. As expected, the accident rate for those with ABS was quite a bit lower than those without ABS. But the surprise was that the death toll was about the same either way!
Seems that those with ABS tended to offset the benefits of ABS simply by driving harder, pushing themselves closer to the line for safety as a result of the certainty that they achieved with ABS.
In other words, people tend to identify "acceptable risk" and when the level of risk reduces, people then engage in riskier behavior in order to gain an advantage. This is not a bad thing - utilizing an advantage is an important part of survival in a "survival of the fittest" universe.
Re:Programmer testing? (Score:5, Interesting)
From the context, it seemed pretty obvious to me that "programmer testing" means testing that is performed by programmers, as opposed to by a separate part of the development team that specializes in testing.
Having the programmer do some of the testing of his/her own code makes sense to me for several reasons:
I'm sure there are other reasons, but the point is this: in many cases, increasing the amount of testing that the programmer can do is advantageous. (At least up to a point -- you need a second pair of eyes, and you need someone who tests how all the modules interact to see if the system as a whole works as expected.) But still, finding ways to make it possible and to make it easy for programmers to add more tests and better tests is usually a good thing.
Re:Edsger Wybe Dijkstra's qoute (Score:2, Interesting)
There is a suprise in Aspect-J (Score:2, Interesting)
When you move beyond the trivial examples, you will encounter Aspect-J's long-standing bugs that simply crash your IDE every five minutes. For example, this P1 critical bug makes Aspect-J unbearable:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=442
I've heard of JBoss AOP being used successfully in production (http://www.jboss.org/products/aop [jboss.org]).