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.


In reply to Re^3: Aspect-Oriented Programming: Couple of Short Examples by rir
in thread Aspect-Oriented Programming: Couple of Short Examples by chunlou

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.