In the previous post I discussed the usage of annotations in domain models, and characterized them as either capturing domain semantics intrinsic to the domain, or semantics pertaining to adjacent layers (eg persistence, or presentation).
I also mentioned though that if you really dislike annotations, it’s quite possible to redefine the Naked Objects programming model so [...]
For me, the best innovation on the Java platform (and .NET too) in recent years has the introduction of annotations/attributes. But not everyone thinks so, even now.
Here’s a comment made to me in an offlist exchange from the DDD yahoo group:
“One thing I can tell you is that I despise attributes / annotations. [...]
In the first post in this series, we saw how to add a new property to a domain object and specify some choices.
One of the aims of Naked Objects is to ensure that our domain objects are behaviourally-complete: that they encapsulate a coherent set of responsibilities. Not anaemic domain models, but OO like your [...]
Naked Objects excels as a rapid prototyping environment. However, many rapid prototyping environments focus on user interface details, and gloss over the underlying domain concepts that sit underneath. With Naked Objects though (because the UI is generated automatically from the domain model), when we do rapid development prototyping we are prototyping the domain [...]
Project Lombok is a recent project that exploits with Java 1.6’s APT (Annotation Processing Tool) API to generate boilerplate code from annotations. In this screencast I show how Lombok can be easily used to remove the boilerplate getters and setters from a pojo domain object.