[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Post-compile Weaving Vs Load-time Weaving


I would add another item to Adrian's list:
* you don't own or control the aspects you are using and want to allow them and your application to evolve independently without the need to rebuild and redeploy your application. In some ways a woven application becomes a blob a bit like an (old fashioned) .exe file. If an aspect changes it may no longer be binary compatible with your application or may rely on new cross-cutting behaviour that was not implemented when originally woven. Yes you will need to retest the application but not rebuild it. You may like to look at the Aspects Equinox Incubator (http://www.eclipse.org/equinox/incubator/aspects/getting_started.php) where we are looking at this whole issue by exploiting OSGi dependencies and versioning.

As well as being a little old (pre-AspectJ5) the article you refer to is perhaps not the best guide to choosing LTW over another weaving phase in that it is making the case for built-in JVM aspect weaving. I support this effort in the long run but even if implemented in the JVM aspect weaving will still incur an overhead both in footprint and pathlength. You must therefore select LTW for the same reason you choose late binding and even JIT compilation in Java: flexibility and portability.

Matthew Webster
AOSD Project
Java Technology Centre, MP146
IBM Hursley Park, Winchester,  SO21 2JN, England
Telephone: +44 196 2816139 (external) 246139 (internal)
Email: Matthew Webster/UK/IBM @ IBMGB, matthew_webster@xxxxxxxxxx

Adrian Colyer <adrian.colyer@xxxxxxxxx>
Sent by: aspectj-users-bounces@xxxxxxxxxxx

08/11/2006 10:11

Please respond to

Re: [aspectj-users] Post-compile Weaving Vs Load-time Weaving

In general you build an application once, and run it many times. Load-time weaving means you pay the cost of weaving every time your application launches. If you do post-compile time weaving as part of your build process, then there will be no overhead at runtime and your application will start faster and use less memory. So I would always opt for post-compile time weaving unless:

* you need the flexibility of changing the set of aspects you are using from run to run
* you are using the aspects for temporary instrumentation (e.g. using Glassbox) - this is really a special case of the above
* you just want to try things out quickly and don't want the hassle of changing your build process

Load-time weaving can also sometimes be beneficial in speeding up certain development scenarios. In general however, why do at runtime what you could easily have done ahead of time...

Regards, Adrian.

On 8 Nov 2006, at 10:00, virendersingh@xxxxxxxxxx wrote:


I was analysing whether one should go for Post-compile weaving or Load-time weaving. I read on the bea site
(http://dev2dev.bea.com/pub/a/2005/08/jvm_aop_1.html) that Load-time weaving (using agents) affects both scalability and usability. Are these issues of scalability and usability applicable to post-compile weaving as well?

Any help on the technical advantage of one over another would be highly appreciated.

Virender Singh,
Consulting and Architecture Team,
HSBC GLT, Pune , India

HSBC Software Development (India) Pvt Ltd
HSBC Center Riverside,West Avenue ,
25 B Kalyani Nagar Pune  411 006 INDIA

Telephone: +91 20 26683000
Fax: +91 20 26681030

This e-mail is confidential. It may also be legally privileged.
If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error,
please delete it and all copies from your system and notify the
sender immediately by return e-mail.

Internet communications cannot be guaranteed to be timely,
secure, error or virus-free. The sender does not accept liability
for any errors or omissions.

aspectj-users mailing list
aspectj-users mailing list