This post originated from an RSS feed registered with Java Buzz
by dion.
Original Post: Scared of annotation hell
Feed Title: techno.blog(Dion)
Feed URL: http://feeds.feedburner.com/dion
Feed Description: blogging about life the universe and everything tech
I am a little bit worried about these annotations. I am worried about two things:
Annotation Hell
This has nothing to do with the technology, rather how it will be abused. I was looking at some code that came from BEA's WebLogic Workshop. The source code was using Controls and such.... and the ration of code to annotations was about 1:10. This doesn't seem right.
We have been seeing this for awhile via XDoclet, and the .NET community is definitely seeing it. I dunno, maybe it is just me, but it scares me. We need to get out some practices for what should be in annotations, and really hope specs will not do crazy things which have you nesting them 5 times.
Coupling of information to source code
Why do we suddenly have to put everything in source code? Does it really make sense to hard code a table name there? If the schema changes we have to recompile code?
Deployment descriptors themselves are NOT intrinsically evil. Angle brackets are also not evil. It was how we were using them that was bad.
This scares me:
@ManyToMany(cascade=CREATE)
@AssociationTable(
table=@Table(name="EMP_PROJ"),
joinColumns=
@JoinColumn(name="EMP_ID", referencedColumnName="ID"),
inverseJoinColumns=
@JoinColumn(name="PROJ_ID", referencedColumnName="ID")
)
public Collection getProjects() { return projects; }
public void setProjects(Collection projects) {
this.projects = projects;
}
We need to think about what really is deployment time information, and what makes sense to be in the source code. The things that I want in annotations are items that make me understand the code better.