BP10: Return interfaces instead of concrete types
Almost always return an interface type and return the most generic one making sense for the typical consuming code.
Anonymous
You never know what an interface type is hiding.
You never know what an interface type is hiding.
Anonymous
I'd disagree and say: Always return conrete Types but only accept interfaces (where appropriate, eg. public methods). This way you don't limit your users but still manage to have lose coupling.
I'd disagree and say: Always return conrete Types but only accept interfaces (where appropriate, eg. public methods). This way you don't limit your users but still manage to have lose coupling.
Anonymous
Don't always blindly return interfaces instead of concrete types. Understand the difference and the implications, then choose depending on your requirements.
Don't always blindly return interfaces instead of concrete types. Understand the difference and the implications, then choose depending on your requirements.