Monday, April 5, 2010

gag - Google Annotations Gallery

gag is a new exciting open source library has been released by Google for Java. Google Annotations Gallery contains handful of annotations to spice up the code. This new library is aiming to express the code in the more realistic way than just plain old non-readable Javadoc comments. 
Not only one can leave expressive remarks in the code, but can use these annotations to draw attention to her poetic endeavors. Apart from static documentation some annotations use runtime instrumentation to perform annotated behavior also. The annotations are divided into following different categories:


Disclaimer: Disclaimer annotations allow you to disclose certain relevant facts about your code. If you want to ease your conscience with full transparency, then consider these annotations.

Enforceable: Enforceable Annotations are annotations enforced by dynamic bytecode instrumentation. Use the following annotations, then run your applications with the javaagent:gag-agent.jar option and your annotations get enforced at runtime.

Literary and Literary Verse: Coding is truly an art. These annotations can help you make your code come alive and help the artist within you be recognized. These speak for themselves . . . so to speak. You'll forever be revered for your code style and your code style. Literary Verse is a newly added sub package of Literary.

Remarks: Remarks annotations replaces the conventional Javadoc comments. These annotations helps better expressing the code than usual Javadoc comments.

Team: This is the new category added recently. The annotations express the team behavior and can be used to express events took place during team development.

Follwing is the list of my personal favorite annotations from the gag gallery:

From Desclaimer:
@com.google.gag.annotation.disclaimer.BossMadeMeDoIt("i swear its not my fault")
@com.google.gag.annotation.disclaimer.IAmAwesome("really, this is the coolest code i have ever written")
@com.google.gag.annotation.disclaimer.WrittenWhile("i m lost, i m lost, omg i m lost")
@com.google.gag.annotation.disclaimer.LegacySucks

From Enforceable:
@com.google.gag.annotation.enforceable.AnswerToTheUltimateQuestionOfLifeTheUniverseAndEverything
@com.google.gag.annotation.enforceable.Noop

From Literary:
@com.google.gag.annotation.literary.Metaphor
@com.google.gag.annotation.literary.Oxymoron("truly a fine mess")

From Remarks:
@com.google.gag.annotation.remark.WTF("this is bullshit")
@com.google.gag.annotation.remark.LOL("this is legend...... wait for it ....ary")
@com.google.gag.annotation.remark.ThisWouldBeOneLineIn(language="groovy", toWit="the method isnt required at all")

From Team:
@com.google.gag.annotation.team.Visionary("this will surely put the Internet back in 90's")
@com.google.gag.annotation.team.Fired(person="asok", reason="well it wasnt his fault")

Well I am enjoying this treat and if you are a gut busting coder I am sure you will also enjoy too. Besides you can also submit your brilliant annotations to the library from the project mailing list.

No comments:

Post a Comment