In the current edition of iX, a German IT magazine, Kent Beck is interviewed about JUnit 4. A statement about using annotations got me thinking. He was asked this question (roughly translated). Q. You have changed the entire architechture of JUnit 4. What was the primary reason for doing this? Were it the features of Java 5 or other testing frameworks? A. The primary inspiration came from NUnit. In hindsight, we understood that the naming conventions in earlier versions of JUnit were, in fact, a simple form of metadata. Making this metadata available explicitly via annotations simplifies the API and helps IDEs creating test support.
Interpreting this statement in a broader sense we come to the differentation of explicit and implicit metadata in general. Annotations are, as Kent stated, the explicit form of metadata, while conventions are the implicit ones. The implications are interesting. Annotations have been received with a lot of criticism. (I might be wrong, but it seems much more so in the Java community compared to the C# community. Again, I might be wrong, but Microsoft developers seem to be less critical of what is decided in the big white tower of wisdom than Java developers. One of the reasons why I feel more like a Java guy.)
As used in JUnit and other frameworks, I see annotations as glue between two or more systems. While explicit metadata in form of annotations is generic glue, implict metadata is industry strengh super glue. It is stronger, but makes the connection more brittle.
There are good reasons for both approaches. Making metadata explicit helps clarifying the intentions of a developer and thereby the design of software. It also is a form of communication between the developer and the user of the system. Compared to conventions, it is more flexible and allows for more loosely coupled systems.
In contrast, a communication via implict standards, as in conventions, requires first and foremost that the existence of that convention is known. Yet, the biggest gain seems to be, that the amount of work of using a system with rigorous conventions is much less compared to systems using annotations.
For myself, I can say that implict metadata, or conventions, are a good thing and I’d prefer them over explicit metadata as long as I want the interaction to be very cohesive. However, if it’s necessary to allow for more flexibility in the interface between two interacting systems, I’d actually prefer annotations.
While the Java and C# communities seem to move toward explicit metadata with annotations and attribues respectively, Ruby people are moving toward implicit metadata, which is said to be one of the nice properties of Rails and the reason why many people like it so much. At the same time, the Java community tries to pick up the advantages of The Ruby Way (e.g. Trails). It seems to me that there is trouble ahead, because it is not possible to be both explicit and implicit at the same time.



What issue of iX would that be? I didn't find it in the table of contents on their website.
Found it.