aspect-oriented programming: is it a crutch

240 views
Skip to first unread message

WIL PANNELL

unread,
Nov 8, 2013, 4:26:55 PM11/8/13
to clean-code...@googlegroups.com
Uncle Bob,

In one of your videos you implement logging for a class in such a way that the class knows nothing about the logger.  The approach is unobtrusive, easy to understand, to apply and to test.

Now my colleagues are introducing aspects on .net for other similar "cross-cutting concerns."  Can you address the question of when such approaches are useful and efficacious?  Why wouldn't the approach you took to implement logging apply to other such "cross-cutting concerns?"

Cheers,

Wil

Ryan Schmitt

unread,
Nov 10, 2013, 8:29:54 PM11/10/13
to clean-code...@googlegroups.com
Where is the video you're referring to?

WIL PANNELL

unread,
Nov 12, 2013, 9:14:59 AM11/12/13
to clean-code...@googlegroups.com
I have to refresh my memory, and then, post back here.

Uncle Bob

unread,
Nov 12, 2013, 4:59:44 PM11/12/13
to clean-code...@googlegroups.com
Wil,

When aspects first came out, I was intrigued by the idea.  But the more I learned, the less I liked it.  The problem is that the pointcuts are tightly coupled to the naming and structure of the code.  Simple name changes can break the pointcuts.  This, of course, leads to rigidity and fragility.  So, nowadays, I don't pay a lot of attention to AOP.  

For my money, the OO techniques that I demonstrated for logging can be pretty easily used for many other cross-cutting concerns.  So the tight name-coupling of AOP isn't really necessary.

Per Lundholm

unread,
Nov 13, 2013, 1:47:03 AM11/13/13
to clean-code...@googlegroups.com

Plus the problem when an unchecked exception shoots through the system and ends up in some aspect code leaving you with very vague ideas about where the real problem lies.

E.g. null pointer in the logging due to some half done object.

Cheers
Per

--
The only way to go fast is to go well.
---
You received this message because you are subscribed to the Google Groups "Clean Code Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clean-code-discu...@googlegroups.com.
To post to this group, send email to clean-code...@googlegroups.com.
Visit this group at http://groups.google.com/group/clean-code-discussion.

Kenneth LeFebvre

unread,
Apr 28, 2015, 12:24:25 PM4/28/15
to clean-code...@googlegroups.com
Can you recall which video has this demonstration?
Reply all
Reply to author
Forward
0 new messages