From: Peter Date: 2003-11-28T03:46:55+09:00 Subject: Re: Method wrapping > And, like i said to Peter, if just the primary method needs a'changin, its a > good indication that a superclass is needed. I think I see the cause of the misunderstanding... Your use of method wrapping is meant to create a complete implementation of a method. Each wrapper adds extra functionality or changes the signature. A good example is a basic class that works on bare data, and wrappers are added to pack and unpack the data, which is really an orthogonal issue. But I would always have created either adapters for that, or just used helper methods, although wrapping sounds more convenient to me. My idea of AOP was a bit different. I wanted to know what AOP was about and so I attended one of the AspectJ guys' tutorials, and I guess I'm a bit biased because of their limited implementation. But the main point in their talk for using AOP was something like logging. When they add an aspect to a method, it doesn't change signature (a signature change in Java means method overloading I believe). Also you can add aspects to methods of other people's classes that don't add functionality, but just "hack in" for your own vile purposes. Things like logging or keeping statistics is a simple example of that (they overuse these examples). And they are on another level of orthogonality because they don't necessarily care about the number of arguments or the type of these arguments. Or they care about just part of that signature, and with some care that can be left unchanged by e.g., only adding new arguments at the end. So my conclusion is that there are two kinds of wrappers: those that make up the base implementation (i.e., the primary method and its required wrappers) and wrappers added for "meta-tasks". The former ones need to be treated as a whole, but the latter ones do not - again, if taken care. I agree that the base implementation must go when the primary method is changed, but not those "meta-task" wrappers. And I do think that removing the latter automatically will create some hassle, but for the former I think that it's OK to do so. Peter