Sunday, August 07, 2005
Well, with all of the noise generated by generics in the java world, it seems annotations got lost in the cracks. They allow you to add metadata to fields, methods, and types. With this metadata, you can reflect at compile-time or run-time. This opens a lot of cool possibilities in java! So, I got down and started to write some example code. One of the first snags that I ran into is that they can not be subtyped even though the syntax for creating them is similiar to interfaces. The second snag was adding behavior which didn't suprise me, but I wished for it. Annotations allow you to capture data into structures. But, the more you play with them, the more you desire to use polymorphism instead of using instanceof everywhere. I think it would have made annotations way more powerful and cool. It just seems they went half way. Why didn't they just make annotations full objects? Anyway, they are still a welcome addition to the language and they are the reason that EJB 3.0 is a lot simpler to create entities. Anything that makes java/j2ee simpler is alright by me.
at 7:36 PM