[
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 | 
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