Monday, February 11, 2013

Annotations - Yet Another "Solution" For A Solved Problem

I just don't get annotations. I mean, I know what they are for and how to use them, I just don't get why I'd want to. They are just another in a long trend in Java (and programming in general) to come up with a new and worse way to solve a problem that already has better solutions.

How did we do what annotations do before annotations? We used configuration files. And that was a Good Thing, because it separated changeable configuration data away from our source code. Yet annotations do exactly the opposite, and put this same information directly in our source code. And coders seem to like this for some inexplicable reason. You know what they say about those who don't know history and all.

But annotations are just one example of this phenomena. The entire design philosophy behind JPA is backwards to me. In the beginning, we had data and we had functions - they were separate. Then some enterprising coders decided that Object Oriented was better, and we should combine data with functions - and that makes sense to me; to keep the data with the functions that manipulate it. And then JPA comes along - and before it DAO - and it was decided that when it comes to database data, we really ought to keep the data separate from the functions that manipulate it - again. But, we'll still say it is object oriented code. You know, because we have classes and stuff.

Don't get me wrong - I use JPA and DAO quite happily in lots of smaller projects because they can save lots of development time. Just don't confuse them with true Object Oriented design, because they aren't. They are Data Oriented © ® design. Hey - I just "invented" something!

No comments:

Post a Comment