Getting excited about Groovy again google for code
Nov 17

Java 5 Annotations: The difference between wanting to see config in the code, or assign it

Java, Tech Add comments

I have been talking to a lot of people about metadata annotations. Although I think they are very useful, I also worry about annotation hell (which I see in some .Net apps).

I think that some people get confused between:

  • “I wish I could see that a piece of configuration affected this class/method/field”
  • “I want to be able to assign some metadata on this class/method/field”

We see this a lot when people move into AOP. People get scared that they can’t SEE that a cross cutting concern module is affecting their code. Some tools help out here, and they are only getting better.

I think the key is that I want to modularize the concern in one place. I want it DRY. Then, if I need to change something, I can do so in that one place, rather than throughout the code (the whole point).

However, people tend to want to put @CrossCuttingConcern on all of the areas in the code to GET AROUND the problem that they aren’t using a tool that shows them, or allows them to configure something at that point.

I think it is going to be interesting to see us mature more, and have views in our code which come from external areas. I should be able to change a pointcut in one place, and have my source view change if it now applies to different places (ADJT in Eclipse).

So, I hope to not mistake the urge to be able to view things, with the ability to assign them in the place that makes sense.

3 Responses to “Java 5 Annotations: The difference between wanting to see config in the code, or assign it”

  1. Aspectivity Says:

    Preferred way of specifying metadata

    I share Dion’s concern about metadata hell. I think the key to using annotations correctly is to realize that annotations supply metadata i.e. additional data about the element being annotated. In other words, annotations should describe the element

  2. nata1 Says:

  3. nata123 Says:

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'cricket'