From users-admin@aspectj.org Tue Jan 15 17:06:37 2002 ----- Original Message ----- > The AspectJ tutorial presentations often start off with > an excellent motivational slide that points to poor > modularization of a logging concern in Apache Tomcat > (http://aspectj.org/documentation/papersAndSlides/FSE2001.pdf). > The slide visually shows the logging concern being highlighted in > red and scattered across several units. > > I recently showed this slide to one of my dissertation committee > members. He asked why this code would be any different than, say, > the multiple appearances of a call to a sqrt function (or even a > println) in an application. His claim was that there would be some > applications where all appearances of "sqrt" would exhibit the same > scattered distribution. He then wanted to know why I did not also suggest > treating all of the sqrt calls as aspects to be separated. > > An outline of my answer to him appears below. I am hoping to write a > piece of this up in my thesis, so, I am requesting some feedback on the > correctness of the answer, or any other insights that any of you might have > to offer... You could look at it this way. The sqrt functionality is a concern or even, colloquially, an aspect of a program. What is being modularized by the function is the decision of how to compute the square root, not "when" or "where" to do it. AOP allows you to, in addition to other things, decide when and where to make a call. You could possibly create an aspect in which sqrt is called at particular joinpoints, say at particular field assignments. But, as with all abstractions you'd have to decide whether the separation is worth the costs. In the case of the square root implementation concern, it pays to separate that out into its own function so that code calling it is not obscured by the details of the implementation. It would only pay to separate the "when" and "where" if it clarified the remaining code or introduced some variability that serves a particular purpose.. some higher level concern that is served by selection of "when" and "where" for some sqrt calls. Michael Feathers www.objectmentor.com __________________________________________________ AspectJ users mailing list - users@aspectj.org To be removed send mail to users-admin@aspectj.org or visit http://aspectj.org/lists