• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

How to make classes in projects using AOP clear?

 
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Author
Posts: 62
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Hong Anderson
Ranch Hand
Posts: 1936
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Beware the other head of science - it bites! Nibble on this message:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic