This post originated from an RSS feed registered with Java Buzz
by Carlos Perez.
Original Post: Meta Tags Revisited
Feed Title: .:Manageability:.
Feed URL: http://www.manageability.org/blog/stuff/rssDisabled?portal_status_message=Syndication+is+Disabled
Feed Description: Random thoughts on the manageability of complex software.
In my earlier blog on "Should Meta Tags be considered Harmful?", I mentioned two reasons why meta tags are useful. It's easier to add and easier to look at. However, there's another reason that I had forgotten.
Meta attributes allow you to annotate classes, methods and their fields, this is equivalent to augmenting the definition of a class itself. For example, a method has properties like visibility or whether its synchronized or final, these are all properties fixed by both the compiler and the reflection library. Meta attributes allow you to place additional properties, this is essentially augmenting the original definition.
However, what I just said is all entirely obvious. But, what I do find interesting is the linkage to my earlier thoughts on "Is it high time to get rid of classes?". If I could use meta tags to augment or essentially redfine the meaning of a Class, then I could use it to make a Class into an Object!
So, one prescription that quickly comes to mind is, use attributes to define a new Object with a Class the target class embedded inside of it. This new object defines the factory for instances of classes (after all new is really a static method on a Class) and it also defines the static methods (defined as normal methods on this object). Matter of fact, this new Object can return objects enhanced with CGLib so that you can intercept any invocation. Intercepting invocation allows you to redefine the very definition of inheritance. Even better, don't even define inheritance, just use attributes on the classes, and implement your own inheritance mechanism!
Very interesting indeed, the combination of "Adaptive Object Model" and Meta Attributes looks extremely promising. Now, if only if I could bolt in "Programming with Adaptors", then I'll be all set!