tags:

views:

116

answers:

4

I was looking at the definition of Spring's PlatformTransactionManager which contains references to TransactionStatus and TransactionDefinition, two other interfaces.

Is this acceptable in general, an interface's definition containing references to other interfaces? When is it useful?

+8  A: 

Yes it's acceptable. Why wouldn't it be ?

It's even better to have references to Interfaces instead of concrete classes for what it worth.

Colin Hebert
Exactly. IMHO a well-designed API can / should usually expose interfaces, enums and annotations, but hardly any concrete classes.
seanizer
+4  A: 

It's absolutely acceptable. Sometimes types need to refer to other types - and if those types in turn represent potentially complex services, it's useful to be able to abstract out a general type, often in the form of an interface.

Jon Skeet
A: 

Its possible... Thats one of the key aspects in implementing multiple inheritence

Sachin Shanbhag
How is that related to the question in any way?
Willi
@Willi - Not sure what is not clear. There are two things asked in question. 1) if references of other interfaces are possible and 2) when is it useful. It seems I have answered both. What is the confusion if you can explain I can correct my answer.
Sachin Shanbhag
The question is not about what's *possible* rather than *acceptable* and *useful*. And referencing other types (or interfaces in this case) has nothing to do with inheritence.
Willi
A: 

Yes. It is possible. I can not think of any scenario where it may create any problems.

Dheeraj Joshi