Well, yes you will have to use new syntax--as my example illustrated. And
yes, AOP is a relatively new paradigm, with the associated wrinkles and
complexity. However, much like OO, it has the potential to revolutionize the
way we program. For instance, instead of using System.err, I could use Log4j
and apply my exception handling changes to the whole codebase in 3
minutes...

I just wanted to bring it up so that people could start thinking about its
potential application to Struts.

Cheers,

Nick

-----Original Message-----
From: John Yu [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 11, 2002 3:13 AM
To: Struts Developers List
Subject: Re: AspectJ and Struts Exception handling:


I did some research on aspect-oriented programming (AOP) about a year ago.

It is a relatively new paradigm. The current stage of AOP is like the stage
of OOP twenty years ago: AOP introduces new syntax. To use it you need a
pre-processor (that's what AspectJ does). (As an analogy, twenty years ago,
C++ introduced new syntax to C. To use C++, you needed C-front to
pre-process C++ into C.)

I personally find AOP intriguing. However, as with any cutting-edge
technologies, we need to treat it with caution. As far as I can see, the
major implication is that developers will no longer write code in Java; we
will write code in "Java++"--Java with AOP syntax. :)
--
John


At 03:51 pm 10-01-2002 -0700, you wrote:
>Hello,
>
>A while back Rick Hightower submitted a request to change the way Struts
>handles errors. His problem (and mine) is that Struts tends to catch
>exceptions and throw different exceptions indicating the problem. Needless
>to say this can badly obscure the original cause of the error.
>
>So today I set about remedying it using AspectJ--an aspect oriented
>extension to Java produced by Xerox PARC (http://www.aspectj.org). I added
>the following aspect to the org.apache.struts package:
>
>public aspect ExceptionLogger+AHs-
>
>   before(Throwable e) : args(e) +ACYAJg- handler(Throwable+-)+AHs-
>     System.err.println(+ACI-Exception caught in the Struts
> framework:+ACI-)+ADs-
>     e.printStackTrace(System.err)+ADs-
>   +AH0-
>+AH0-
>
>Then I compiled Struts with an Ant task for AspectJ compilation:
>
>+ADw-target name+AD0AIg-compile.library+ACI-
>depends+AD0AIg-prepare.library+ACI-
>      description+AD0AIg-Compile Struts library files+ACIAPg-
>         +ADw-ajc srcdir+AD0AIgAkAHs-src.share.dir+AH0AIg-
>             destdir+AD0AIgAkAHs-build.home+AH0-/library/classes+ACIAPg-
>             +ADw-classpath refid+AD0AIg-compile.classpath+ACI-/+AD4-
>         +ADw-/ajc+AD4-
>           +AFs-...task continues as normal...+AF0-
>
>Now all exceptions caught in the Struts framework are automatically logged
>to System.err.
>
>So my question is:
>
>Should we consider the use of AspectJ in Struts? This would potentially
>have no effect on the users of the framework, but could be valuable for
>implementing logging and error-handling policies. The above code could be
>modified to write to a log4j log if that would be more convenient.
>
>Does this intrigue anyone? Should we continue investigation?
>
>Cheers,
>
>Nicholas Lesiecki
>
>(For more info on AspectJ, look for my forthcoming article on IBM's
>developerWorks.)
>
>Technical Team Lead
>eBlox, Inc.
>(520) 615-9345 x104
>Check out my new book+ACE-:
>Java Tools for Extreme Programming: Mastering Open Source Tools, including
>Ant, JUnit, and Cactus
>
>http://www.amazon.com/exec/obidos/ASIN/047120708X/
>
>
>
>
>--
>To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>

--
John Yu                       Scioworks Technologies
e: [EMAIL PROTECTED]         w: +(65) 873 5989
w: http://www.scioworks.com   m: +(65) 9782 9610

Scioworks Camino - "Rapid WebApp Assembly for Struts"


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to