Annotations with Meaning

Background

There are some annotations which exist not to directly offer functionality but as a helper for the developer and for the developers which follow. There are some annotations which should exist, but have yet to reach the public eye. We will look at several of these annotations for the modern developer.

One annotation which fits into the already-existing-and-insanely-useful category is the @Deprecated┬áannotation. The word “deprecate” actually means “express disapproval of” but in the development world the @Deprecated┬átag is used to show a class or other piece of code which has been tested extensively and found to be so useful that it has eventually earned the much-lauded @Deprecated┬á┬ástatus.

For an example of this, refer to the java.util.Date class, where every useful method has been marked @Deprecated. Although it is handy to have this sort of sign, it would be equally convenient to have an annotation that indicated code that should be avoided at all costs.

@NeoAnnotations(“Defecated”)

As one potential candidate for this role, I propose a @Defecated tag. This would show code that is so distasteful to the senses that by all rights it should be deleted, but cannot be due to legacy issues. Any coder found using these methods, or creating them, should be beaten severely.

For visual’s sake, this annotation should ideally extend the┬á @Deprecated┬áannotation. Unfortunately, Java annotations cannot extend other annotations yet, so it may only be in Java 8 that the full potential of this annotation can be realized.

@NeoAnnotations(“LitterBug”)

Some people have difficulty letting go – the hoarders of this world, the people with boxes full of old, broken toys. We find similar people in the development world – people who grow attached to code and feel that even though they don’t need it now, they may need it in the future. The people who comment out unnecessary code and check it in, instead of just deleting the obsolete code outright.

It may not even be their fault, they may be possessed with that gathering instinct. Marking their code with the @LitterBug┬áannotation could be the only way they’re going to realize what they’re doing. ┬áThey’re not just making the code unreadable, by breaking its flow, potentially introducing old bugs as zombies, and needlessly inflating the code size, but they’re contributing to the carbon footprint of the servers and eventually to entropy and the destruction of our universe.

But let’s be honest here – they probably do.┬áCommenting out code instead of deleting it is like stuffing garbage down the back of your couch instead of throwing it away.

So markup that marked-up block, for the good of us all. An optional value parameter allows you to put in a personal message of encouragement, or threat of physical harm, so that the coder in question knows that you’ve taken the time out to consider their well-being in one way or another.

 

Tagged with: , , ,
Posted in Java
One comment on “Annotations with Meaning
  1. Zeliaselena says:

    Well, my code would be full of “@litterbug” ah ah !

Leave a Reply