[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [aspectj-users] Some Noob Design Questions
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Thu, 24 May 2012 13:00:09 -0700
- Delivered-to: email@example.com
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=A8aJtjCGijX4TeoyjOTNNHGeC0NXu2gkYFjm45Ao6GQ=; b=L1iEi3WAAIDGLFEBJNBhYBQR/5QAxD3HCBnVZm6NDOtr+jwqE38HIILZ0mZR66pjaT gmvO4HQAerFGz7qfPnXU86HXXssKWk90IDR494OO7TWrM/NwM6L4mQcD9t1ONwZBbULR vD6bg+3iUaZ3UljkU9Wo5XCSo3wuYfKargFuG13TtKXz4C87uCuTeYwW44LHTNcMCeGu lDphscnL7Bgeh8X4j0duVuwkX9YGlVSNuZI33B1+B5PGy4pXS6GMO0wC+/yBwWLUlpoO 7z15WltbADOA6vNSRLDps7B856Dpaoe1ThhhyQPUjGp3omiziPK/02ke4c31QJJeFvoH Qx5A==
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.
On 24 May 2012 03:00, El Lunes <el.lun3s@xxxxxxxxx> wrote:
> 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