Fog Creek Software
Discussion Board

Utility functions and Aspect Oriented

Andrew Hurst asked a question about Utility Functions last Friday. (
I have read about Aspect Oriented programming before, but I could not remember the buzzwords. This morning, Slashdot refreshed my memory:
Some links that explain better than I could:
Has anyone used this in a real project? It seems like the solution Andrew is looking for.

Doug Withau
Tuesday, March 4, 2003

From my reading of Aspect Oriented Programming, it seems more suited to the "insert debug statements" type programming.  Thats the clearest example I've heard it used for.  They don't affect the flow of the program since they don't change anything if removed.  I wasn't too fond of the example where the routine that started writing out the page in his JSP's would have an aspect to check for the user being logged in.  Didn't seem too intuitive to me.

Regarding whether it did what I was asking before, I don't think so.  The functions/methods I was talking about before were needed but didn't fit in the library.  I don't think you'd set up an aspect to make sure every file path represented as a string had a trailing slash.

Though, anyone around here used AOP?  It sounds interesting, but the possible spaghetti code factor really scares me away from it...

Andrew Hurst
Tuesday, March 4, 2003

In case Aspect Programming is not limited to Java, will you let us know what other language allows for aspect programming?

Li-fan Chen
Tuesday, March 4, 2003

Li-fan, perhaps this would help you...

Tuesday, March 4, 2003

AOP has been researched in many different environments. In the .NET world there has been some buzz recently on Clemens Vasters' AOP ServicedComponents work.

Personally I find this interesting but dangerous stuff. If used widely the codeweaving has the potential to trow up some pretty scary hairballs IMHO.

Just me (Sir to you)
Tuesday, March 4, 2003

Check out this ( ) response from John Lam on AOP.  Personally I'm working on an AOP-like framework ( ) that doesn't magically add in aspects.  When debugging you would actually step threw the code.  Also you might want to check out extensible C# ( ).  It uses attributes to inject code into your objects before a complete compile.  XC# isn't complete AOP, but it gives quite a bit of the benefit without hiding anything.

Justin Rudd
Tuesday, March 4, 2003

Actually, the impact on control flow reminds me of INTERCAL's COME FROM construct.

Tuesday, March 4, 2003

The general goal of AOP is to isolate system concerns (security, persistence, threading and synchronization, transactions, resource pooling, logging) from the core "business" concerns (manipulating data, business rules) and doing it in a transparent way.  This simplifies code maintainence and makes it easy to integrate new system services with existing business code at deployment time.

AOP techniques are currently common in a lot of Java persistence frameworks.  A lot of Java O/R tools (Hibernate, Castor, OJB) use dynamic proxies or runtime code generation to intercept method calls and save or load objects appropriately.  JBoss 4 is basing its whole EJB implementation on AOP practices.

Colin Evans
Tuesday, March 4, 2003

Beware of Aspect-Oriented programming.  It is patented.

See US patents 6,467,086 and 6,442,750 :,467,086.WKU.&OS=PN/6,467,086&RS=PN/6,467,086,442,750.WKU.&OS=PN/6,442,750&RS=PN/6,442,750

T. Norman
Thursday, March 6, 2003

"It is patented"

What isn't?

Just me (Sir to you)
Friday, March 7, 2003

It's patented by Xerox. If ever a company was guaranteed to drop the ball on innovative technology, it's them.

Chris Tavares
Friday, March 7, 2003

*  Recent Topics

*  Fog Creek Home