File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Aspect Oriented Programming and the fly likes Which type of design patterns Aspect oriented programming uses internally? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Frameworks » Aspect Oriented Programming
Bookmark "Which type of design patterns Aspect oriented programming uses internally?" Watch "Which type of design patterns Aspect oriented programming uses internally?" New topic
Author

Which type of design patterns Aspect oriented programming uses internally?

Raj Datla
Greenhorn

Joined: Sep 07, 2006
Posts: 4

Hi All,

Which type of design patterns Aspect oriented programming uses internally?.

Regards
Raj
Matthew Groves
Greenhorn

Joined: Jul 21, 2013
Posts: 1
I'm not a Java developer, but I know something about AOP in .NET, and it's probably very similar, so I chime in hesitantly:

The design patterns that are used internally vary among implementations. If you're using a runtime interception framework (maybe Spring in Java?), then types are generated at runtime with reflection. These types are decorator classes that follow the decorator pattern. You could consider AOP to basically be dynamic decorators (a bit over-simplified, but it's a good place to start).

The other main type of AOP implementation is compile-time, which manipulates byte code during/after you've compiled your program (I think AspectJ does this in Java). I can't tell you offhand exactly what AspectJ changes, but if you use a decompiler, you might be able to get an idea (again, I'm a .NET guy, so this may or may not exactly translate to Java). In the .NET world, these compile-time tools don't necessarily use a pattern like decorator--they just manipulate/enhance the code using the aspects. But as you're writing code, it definitely appears very much like the decorator pattern.

I'm sure there are other patterns used internally that aren't strictly relevant to AOP (e.g. maybe an AOP tool uses singletons, an abstract factory, etc, but that will be true of many libraries, not just AOP libraries).
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Which type of design patterns Aspect oriented programming uses internally?