My feeling on this is that domain objects (not domain entities, as that title implies something to do with a database) should not be interfaces unless you have a very compelling reason to believe that you will need to support multiple implementations at some point in the future.
Consider that the domain model is the human model. The business/service/document is, literally, the domain. Most of us are developing software for a single business or purpose. If the domain model changes, it is because the business rules have changed, and therefore the old domain model is no longer valid - there is no reason to keep the old one around, running alongside the new one.
The debate is obviously not black-and-white. You might be developing software that is heavily customized at multiple client sites. You might really need to implement different sets of business rules at the same time, and simultaneously have a genuine need to fit them into a unified architecture. But, in my experience at least, these cases are the exception rather than the rule, and although I am not generally fond of the term, this might be a case where you should be thinking to yourself, YAGNI.
Data access is a common area where you want better abstractions (persistence ignorance). In your example, you have NHibernate attributes on your model class. But adding persistence attributes makes it no longer a true domain class because it introduces a dependency on NHibernate. NHibernate and Fluent NHibernate support mapping POCOs using an external mapping declaration instead of attributes on the data class, and this tends to be the preferred approach when using ORMs such as NHibernate or EF4, because it breaks the dependency between persistence model and domain model.
If these mapping methods weren't supported, and you had to use attributes, then I might indeed suggest using interfaces instead, but ORMs today are more sophisticated than that, using reflection and dynamic proxies and method interception to do most of the heavy lifting, so you don't need to create your own abstractions here.
Some types of objects that you would want to expose as interfaces are:
- Repositories, which are responsible for loading/saving domain objects;
- Plugins/extensions to your program;
- View/presenter models, so that different UIs can be plugged in;
- Abstract data types with many implementations (array, list, dictionary, record set, and data table are all sequences AKA
IEnumerable
);
- Abstract operations with many possible algorithms (sort, search, compare);
- Communication models (same operations over TCP/IP, named pipes, RS-232);
- Anything platform-specific, if you plan to deploy to more than one (Mac/Windows/*nix).
That's by no means a complete list but it should illuminate the basic principle here, which is that the things best-suited to interface abstractions are the things that:
- Depend on factors that are likely beyond your control;
- Are likely to change in the future; and
- Are horizontal features (used in many parts of the app/architecture).
A domain class will be widely used, but does not fit into either of the first two categories; it is not likely to change, and you have almost complete control over the design. Therefore, unless the classes themselves will be taking on indirect dependencies (which is a situation you should try to avoid whenever possible), I would not go through the extra effort of creating an interface for every class in the domain model.