Is there a project that maintains annotations for patterns?
For example, when I write a builder, I want to mark it with @Builder
.
Annotating in this way immediately provides a clear idea of what the code implements. Also, the Javadoc of the @Builder
annotation can reference explanations of the builder pattern. Furthermore, navigating from the Javadoc of a builder implementation to @Builder
Javadoc is made easy by annotating @Builder
with @Documented
.
I've being slowing accumulating a small set of such annotations for patterns and idioms that I have in my code, but I'd like to leverage a more complete existing project if it exists. If there is no such project, maybe I can share what I have by spinning it off to a separate pattern/idiom annotation project.
Update: I've created the Pattern Notes project in response to this discussion. Contributions welcome! Here is @Builder
This seems like a misuse of annotations to me. Sure, I could see why you might want to note what design pattern a class is helping to implement, but just using the Javadoc and/or the name of the class seems more appropriate. The name of the pattern that you're using is of no actual importance to the code itself... patterns are just a guide for an often used way of solving a problem. A comment would suffice, rather than creating a new file for every pattern you use.
This is an interesting solution, but I keep wondering what's really the problem you're solving with this? Or in other words, what do you get from using something like this what you don't get by a proper comment on top of your class about it's usage?
I can think of a few cons but can't think of benefits apart from this being the nice standardized way to document code.
Cons would be, namely:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With