Wednesday, March 09, 2005

Attributes/Annotation usage

.NET introduced the concept of "Attributes". Java 1.5 came out with a similar concept called "Annotations". They take a while to fully understand. Examples always help and here's one that does a good job of explaining WHAT they accomplish.

It's interesting to see the evolution of languages and how newer features are just formalized notions of what you could do before that feature came to be. More often than not, it was just "hacking" a feature for something it was'nt really meant for. Classes (from Structs), Interfaces (from Abstract Base Classes with no implementation), Enums (from grouping named constants), Properties (from Getters/Setters), Events (from function pointers) and now Attributes/Annotations (from Marker Interfaces?) all fall into this category.

No comments: