File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes How to make classes in projects using AOP clear? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "How to make classes in projects using AOP clear?" Watch "How to make classes in projects using AOP clear?" New topic
Author

How to make classes in projects using AOP clear?

Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
When using AOP we will not know what is the full functionality of a class, and we cannot be sure that can we refactor this class or not.
Because just looking at the code will not see what will actually happen at run-time. And refactoring might break additional functionality from the defined aspects/pointcuts.

Is there any way to solve these problems? Can we write comments to state that this class use AOP, and list Aspects for the class? But if we do so we need to maintain the comments, and the comments can be out of sync.


SCJA 1.0, SCJP 1.4, SCWCD 1.4, SCBCD 1.3, SCJP 5.0, SCEA 5, SCBCD 5; OCUP - Fundamental, Intermediate and Advanced; IBM Certified Solution Designer - OOAD, vUML 2; SpringSource Certified Spring Professional
Ramnivas Laddad
Author
Ranch Hand

Joined: Jul 23, 2003
Posts: 62
You have two options:
1. Use AspectJ tools, especially AJDT that will show you how classes are interacting with aspects
2. Use annotations and select join point based on those annotations. This way, class developer will see code such as @Transactional (almost similar to comments idea you mentioned) and know that certain AOP functionality is applied there.

-Ramnivas


Ramnivas Laddad
Author, AspectJ in Action (http://manning.com/laddad2)
Twitter: ramnivas
Hong Anderson
Ranch Hand

Joined: Jul 05, 2005
Posts: 1936
Many thanks. For the first option, it requires additional tools which is not convenient in many cases. For example, AJDT is for Eclipse only, if we use other IDEs or text editors like Notepad++, vi we'll miss the information.

Using annotations is a good idea, it will work for every editor. I'll try next time I use AOP. Thanks a lot.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to make classes in projects using AOP clear?
 
Similar Threads
AOP
AOP
What is AOP?
AOP anyone?
Metaphors of AOP