Today I came to the fundamental paradox of the style of object programming, specific types or interfaces.
What are the better choices for the type of the return method: a specific type or interface?
In most cases, I prefer to use specific types as the return type for methods. because I believe that a particular type is more flexible for future use and provides more functionality.
The dark side of this: Grip. Angelic: a particular type contains the interface from which you intend to return initially, and additional functionality.
What is the rule of thumb?
Is there any programming principle for this?
BONUS . Is this an example of what I mean ReadOnlyCollection or IEnumerable for publishing member collections?
methods oop design-principles
SDReyes Apr 21 '10 at 0:02 2010-04-21 00:02
source share