Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Exception handling done thru AOP

Wes,

Could you please give an example when you would keep log statements in some class and still did not mix two concerns?


From: "Wes Isberg" <wes@xxxxxxxxxxxxxx>
Reply-To: aspectj-users@xxxxxxxxxxx
To: aspectj-users@xxxxxxxxxxx
Subject: Re: [aspectj-users] Exception handling done thru AOP
Date: Wed, 25 Aug 2004 22:27:18 -0700

> I thought that logging or exception handling itself is a crosscutting
> concern in all cases and that the goal is to separate all
> logging/excepting
> handling code out from primary concern code

fwiw, I think of a concern not so much as a particular activity
(logging, error handling) as a requirement or invariant; some
of these require aspects to implement in a modular way. e.g., the
invariant "A RemoteException should be caught in the message layer,
and the application exception unwrapped, logged, and rethrown" would
translate to advice that handles the exception in the message layer
and some declare-error statements about RemoteException handlers
in other layers.  Other non-crosscutting requirements I can write
in a modular way in Java.  So I go through the requirements, use Java
when I can, and use AspectJ when it's more modular.  I end up with
a mix where "logging" (or "error handling" or ...) might be done in
both Java and AspectJ, but the code for a particular requirement is
in one place, if I need to change it.

Wes

> ------------Original Message------------
> From: "Paul Kusch" <belmondo_paul@xxxxxxxxxxx>
> To: aspectj-users@xxxxxxxxxxx
> Date: Wed, Aug-25-2004 6:39 PM
> Subject: Re: [aspectj-users] Exception handling done thru AOP
>
> Ron,
>
> I thought that logging or exception handling itself is a crosscutting
> concern in all cases and that the goal is to separate all
> logging/excepting
> handling code out from primary concern code even though it means to
> create
> aspect that is used just in one place in the application. But what I am
>
> reading is that the goal is more reuse and that it makes sense to
> extract
> only those parts of crosscutting concerns that are reused and save
> lines of
> code and eliminate duplication.
>
> Actually this was the reason why I was not sure if AOP should be used
> in all
> cases. If I separate say all logging or exception handling I end up
> with
> nice and clean primary concern code but I have aspects that apply only
> in
> one place which means more lines of code than when inlined.
>
> Paul
>
>
> >From: "Ron Bodkin" <rbodkin@xxxxxxxxxxxxxx>
> >Reply-To: aspectj-users@xxxxxxxxxxx
> >To: aspectj-users@xxxxxxxxxxx
> >Subject: Re: [aspectj-users] Exception handling done thru AOP
> >Date: Mon, 23 Aug 2004 10:25:33 +0200
> >
> >Paul,
> >
> >I often use AOP to handle exceptions and find it valuable. At the same
>
> >time, there are definitely some cases where exceptions and their
> handling
> >are *not* crosscutting, and it is helpfully to explicitly throw them
> and to
> >explicitly handle them in a method. There are also cases where you
> might
> >start with inline exception handling and then refactor into an aspect
> as
> >you realize there _is_ a common policy that can be captured.
> >
> >The moral here is to use aspects to modularize crosscutting concerns.
> This
> >is true for applying AOP for other concerns that are often
> crosscutting but
> >sometimes specialized (e.g., logging errors and tracing is natural but
>
> >sometimes logging is really tied to a specific line of code).
> >
> >Ron Bodkin
> >Chief Technology Officer
> >New Aspects of Software
> >o: (415) 824-4690
> >m: (415) 509-2895
> >
> >
> > > ------------Original Message------------
> > > From: "Paul Kusch" <belmondo_paul@xxxxxxxxxxx>
> > > To: aspectj-users@xxxxxxxxxxx
> > > Date: Fri, Aug-20-2004 3:16 PM
> > > Subject: [aspectj-users] Exception handling done thru AOP
> > >
> > > Hello,
> > >
> > > I was experimenting with AJ to extract exceptional flows and have
> mixed
> > >
> > > feelings. Could you please share your experience? Do you have now
> > > applications without any catch statement in primary concern or are
> you
> > > being
> > > selective where you use AOP and where you embed catch statements in
> > > primary
> > > concern code.
> > >
> > > Thank you,
> > > Paul
> > >
> > > _________________________________________________________________
> > > Get ready for school! Find articles, homework help and more in the
> Back
> > > to
> > > School Guide! http://special.msn.com/network/04backtoschool.armx
> > >
> > > _______________________________________________
> > > aspectj-users mailing list
> > > aspectj-users@xxxxxxxxxxx
> > > http://dev.eclipse.org/mailman/listinfo/aspectj-users
> > >
> > >
> >
> >_______________________________________________
> >aspectj-users mailing list
> >aspectj-users@xxxxxxxxxxx
> >http://dev.eclipse.org/mailman/listinfo/aspectj-users
>
> _________________________________________________________________
> Is your PC infected? Get a FREE online computer virus scan from McAfee®
>
> Security. http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> http://dev.eclipse.org/mailman/listinfo/aspectj-users
>


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
http://dev.eclipse.org/mailman/listinfo/aspectj-users

_________________________________________________________________
FREE pop-up blocking with the new MSN Toolbar – get it now! http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/



Back to the top