To be sure, that programming against connects is a great practice. Generally in Java "interface" within this sense means the word what construct interface, to ensure that you are writing an interface as well as an implementation class which you apply the interface rather than the implementation class more often than not.

I question if this is an excellent practice for writing domain models too. So, for instance if you have a website class Customer and every customer might have a listing of Orders, can you generally also write connects ICustomer and IOrder. As well as would Customer have a listing of IOrders rather than Orders? Or can you use connects within the domain model, only when it really is driven through the domain, e.g. you have a minimum of two various kinds of Orders? Quite simply, can you use connects due to only technical needs within the domain model, or only when it's really appropriate regarding the particular domain?

Writing connects "simply becauseInch strikes me like a total waste of time and, as well as a breach from the Hug-principle.

I write them when they're really helpful in representing common behavior of related classes, not only like a fancy header file.

Don't over design the body. Should you discover you have various kinds Orders and think it's appropriate to declare an interface for Orders than refactor it once the need arises. For domain models, the probability is high the specific interface can change much within the duration of development, therefore it rarely helpful to create an interface early.

Connects are a very good way of separating components for unit testing reasons and general dependency management. Stating that, I frequently prefer abstract classes so a minimum of a few of the common behavior is offloaded there instead of forcing a few of the duplication that connects bring. Modern IDEs allow it to be fast and simple to create connects so that they aren't that much work :-)

I'd recommend remaining lean and agile - avoid anything until you must do it, then let your IDE perform the refactoring for you personally when it's needed.

Its pretty trivial in IDEA/eclipse to show a concrete class into an interface when you choose you'll need one.

Then use dependency injection with Spring or Guice for those who have many implementations from the interface to inject in to the places inside your code you are using 'new'

No, I just use connects on Domain Objects to ensure that they're loosely combined. For me personally the primary hook of developing my very own code with connects is will be able to easily create mocks when you are performing Unit Testing. I do not begin to see the reason for mocking Domain Objects because they not have the same dependencies that the service layer or DAO layer class might have.

This certainly does not mean to stray from using Connects in Domain Objects. Use where appropriate. For instance, recently I have been focusing on a webapp where various kinds of Domain Objects match permalink pages by which customers can leave comments. So, all these Domain Objects now implement the "Commentable" interface. All the comment-based code will be designed towards the Commentable interface rather than the Domain Objects.