Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Aspect Oriented Programming (AOP): Using AspectJ to implement and enforce coding standards

Thanks for the feedback!  I was focusing on showing possible uses for
aspects and not so much on completeness.  I guess it shows ;-)

Also, I'm currently working on an article to show how to use aspects to
implement/enforce design patterns.  If anyone has any work they'd like to
contribute, it would be much appreciated!

> - Declaring an error on the following pointcut misses the
>   case where a field in one class is set by another class,
>   or where one field is written from another setter;
>   it also requires constructors to use setters, even
>   though some setters are written to assume the object
>   has been initialized.
Good catch... The first issue is in the Javadoc, but I didn't consider the
last point.  That should be easy to fix.  Any ideas about how to catch those
other situations at compile time?

> - The following pointcut is pretty expensive at compile time,
>   and applies to system library calls which might be defined
>   to return null at various points:
Any ideas for a less expensive technique?  I changed the code so that it
won't throw an exception, but will call System.err.println() with the same
message.  Sometimes null return values from system calls can cause
confusion, so at least it signals the issue.

> - fyi, I don't understand your logging aspect.  For example,
>   I'm not sure what you intended, but you have
>   one logger, not multiple (per-class) loggers, here:
Oops... that wasn't one of the test cases :-)

----- Original Message -----
From: "Wes Isberg" <wes@xxxxxxxxxxxxxx>
To: <aspectj-users@xxxxxxxxxxx>
Sent: Thursday, January 23, 2003 10:57 PM
Subject: Re: [aspectj-users] Aspect Oriented Programming (AOP): Using
AspectJ to implement and enforce coding standards


> Nice topic.  I'm curious what Ron Bodkin thinks about it,
> since he's also interested in enforcing coding standards.
>
> Here's some feedback based on a brief review of the article
> but not looking at the sample code download.  Some code comments
> and then general ones:
>
> - Declaring an error on the following pointcut misses the
>   case where a field in one class is set by another class,
>   or where one field is written from another setter;
>   it also requires constructors to use setters, even
>   though some setters are written to assume the object
>   has been initialized.
>
>     pointcut directMemberAssignment():
>       set(* *.*) && !withincode(* set*(..));
>
> - The following pointcut is pretty expensive at compile time,
>   and applies to system library calls which might be defined
>   to return null at various points:
>
>     //The first primitive pointcut matches all calls,
>     //The second avoids those that have a void return type.
>     pointcut methodsThatReturnObjects():
>           call(* *.*(..)) && !call(void *.*(..))
>
>
> - fyi, I don't understand your logging aspect.  For example,
>   I'm not sure what you intended, but you have
>   one logger, not multiple (per-class) loggers, here:
>
>     //Static introduction!
>     private static Logger ILoggable.fLogger;
>
>   (same comment for your method declaration)
>
>   I'm not sure why there is a logger instance in the (singleton?)
>   aspect which tracks the handlers, either.  Not thread-safe?
>
>   For per-class logging under AspectJ 1.0, one solution is
>   presented in the old user mailing list archives (I think with
>   a title like "accessing static members for Log4J").  Perhaps
>   your solution works in 1.1; as I said, I didn't try the code,
>   so forgive any misperceptions.
>
> Your distinction between runtime and compile-time aspects
> might be unclear.  It might help to explain that declare error/
> warning works only at compile-time, and only with staticly-
> determinable pointcuts.
>
> Finally, a list of resources at the end might be helpful. Some
> of the articles listed on the AspectJ PARC page are on point.
>
> Wes
>
> > "R. Dale Asberry" wrote:
> >
> > I started writing this article last October, but only recently completed
> > it.  Please let me know what you think!
> >
> > Aspect Oriented Programming (AOP): Using AspectJ to implement and
enforce
> > coding standards
> > http://www.daleasberry.com/newsletters/200210/20021002.shtml
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>



Back to the top