Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-dev] Fwd: static context/pointcuts (was [aspectj-users] Object Graph using aspectj)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Eric Tanter schrieb:
> I would personally think that this last solution makes a lot of sense, 
> because there are no "surprises"
...
> I guess what I'm really struggling with is the fact that binding 'this' in
> the pointcut is really semantically different from obtaining 'this' using
> thisJoinPoint.getThis(), since the former implies not matching at all in
> static context, while the latter does.
indeed. "this is YXZ" means something different than "get me this please".

> But I see your point, and it's true that "in most cases" the current design
> is "ok".


Hi Eric,

probably for this kind of questions it is not the primary concern if
a design feels "ok" to the user, but the primary and foremost concern
is to be *correct*, which means that it is logically consistent.
Then, if it is a real beautiful design, it also feels "ok" to the
user at the same time.

In practical programming, we often guide our steps by what we want to
achieve and by our knowledge "how it works". When viewed from this side,
a statement based on logic often seems as if besides the point.

You shouldn't overlook that pointcuts are an example of declarative
programming. When adhering to this style of programming, you state a
given logical relationship of concepts and deliberately *don't* ask
how it works or is going to be computed. Employing this style of
programming may require a certain shift of focus by the programmer,
which initially means some effort.

But it's worth the effort, IMHO. I'll tell you why: looking at things
from the logic side in addition to the "I am doing this"-viewpoint
can give you a double-check and is, to my own experience, surprisingly
good in spotting hidden design misconceptions.

Personally, I'd take the fact that I get problems coming up with a simple
set of pointcuts as an indication that something in the design of my
program isn't orthogonal. To use your example: a Class is a concept
and an instance is a thing. So I'd ask myself, why do I want to treat
a concept, as if it was a thing? Maybe some of the Classes you try to
match actually should be converted to be instances (e.g. singletons)?

in the hope this helps understanding the issue better...
	Hermann V.




-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFJTnJ3ZbZrB6HelLIRAvB0AKCMX8ayrTN5r2IVPGGHnaU+fNd6GwCg9RNT
VNrqMDiVEDBIHxSmZSRzR6Q=
=9jn+
-----END PGP SIGNATURE-----


Back to the top