Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Some Noob Design Questions

Hi,

There isn't a right/wrong way to do it (one way isn't really 'faster'
than the other), it comes down to thinking about what your aspect is
trying to achieve.  All the interfaces you want to add are related to
'testing', perhaps you want a Testing aspect that applies everything
you need across your codebase, that would be fine.  But if your
interfaces fall into categories - like, maybe interfaces for unit
testing and interfaces for integration testing, then you might create
a UnitTesting aspect and an IntegrationTesting aspect.  Same thing
applies to the methods.  The aspect is a unit of modularization for a
crosscutting concern (like 'logging', 'profiling' or whatever) - if it
makes sense for you to think about it as one concern, then capture it
in just the one aspect.

Another (related) factor to keep in mind is will you ever want some
subset of the interfaces/methods to be applied.  If you do then you
may want to break it into multiple aspects so you can pick and choose
what gets applied on a particular compile/run.

cheers,
Andy

On 24 May 2012 03:00, El Lunes <el.lun3s@xxxxxxxxx> wrote:
> Hallo
>
> I am pretty new to AspectJ and I want to add interfaces to some classes. I
> have to do this with AspectJ, because I need these interfaces for testing
> but I am not allowed to change the code.
> It was no problem to add the interfaces but I am not sure where to put the
> code. Is it better to create only one aspect that adds all the interfaces or
> should I use one aspect per interface?
>
> I have the same question regarding added methods. One aspect per class or on
> aspect that adds all methods to all classes?
>
> Thanks for your help!
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>


Back to the top