Depends on the context.
I was responding to the mechanism as presented in this thread. I apologize for being unclear.
Just because a technique can cause fragility does not mean that the entire technique is worthless.
I don't think anyone suggested that the technique had
no worth. Invasive code altering techniques like this
have incredible power. The weakness is the shabby instrumentation used
to control this power; correctly constructing
the regexes requires
visiting every function that falls within the applicable scope.
Thereafter safely adding any function requires finding and
reviewing every applicable regex.
For example, I still use inheritance when appropriate - despite the fragile base class problem
This is a very similar issue. It's nearly equivalent
when the maintainers of the base class might be unaware that
their code is being inherited. My first serious criticism of
C++ was for its lack of a DO_NOT_INHERIT_FROM_ME mechanism.
aspects can make your application a lot less fragile in the face of change.
You're entitled to your opinion. I would like to
see you support it.
If you need to change your logging system or persistence layer you just need to alter a single aspect - rather than manually update thousands of methods.
This is not support. This only points again to the power of
AOP to quickly make sweeping changes, not to the resilience
of the resultant code.
I say there are no protections built into the system and
that the locality of lexical reference is wrong. I can't imagine
I'd plan to use AOP on a codebase that has not been
written. Rather than use AOP I'd prefer to go one
step further and use the regex and another tool to explicitly
insert the desired code into the desired functions.
If I am missing some bit of AOP that addresses these
issues I'd be glad to be educated.