[aosd-discuss] "AOP considered harmful"
Robin Green
greenrd at greenrd.org
Wed Apr 27 20:37:51 EST 2005
On Wed, Apr 27, 2005 at 07:57:22PM -0500, Dean Wampler wrote:
> I've given some thought to applying Meyer's "Design by Contract" (DbC)
> to aspects and how aspects need to respect the contract of the advised
> code.
>
> The Liskov Substitution Principal applies; If a class is substitutable
> for an interface, then the class+advice must be, too.
Not neccessarily. As Awais and I pointed out some years ago, aspects can
be used for many different purposes: an aspect might be used to modify the
behaviour of a class, and thus the contract, completely intentionally! [1]
Unlike with classes and subclasses, it is possible with aspects to say
"This aspect should always be woven in to every instance of the class,
or to every instance of the class that satisfies such-and-such conditions",
so it is not necessarily incoherent for an aspect to change the contract of
a method.
With classes you can make an abstract class, but that can still be extended,
so substitutability is arguably needed between classes and their subclasses.
It is _not_ always needed between "unwoven" classes and their "woven" equivalents
- because often a "woven" class does not have to coexist with its "unwoven"
parent.
Ah, but what about tool support? Yes indeed, I personally think we should focus on
formalising real-world languages or make real-world languages that are
formalisable (which is what I am trying to do) before we start playing too
much with tool support for "intentional contract-breaking". ;)
Have to walk before you can run.
--
Robin
[1] Even a logging aspect can turn a pure function into an impure function with
side-effects... although that's more to do with the fact that functional
purity is an eye-rollingly pedantic concept when it comes to this kind of edge
case ;)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : /pipermail/discuss_aosd.net/attachments/20050428/126a015e/attachment-0001.bin
More information about the discuss
mailing list