what does it mean by static type safety?

as above...
and what does this sentence mean:
But maybe the most important problem of an overly rich interface is loss of static type safety
Last edited on
An interface should address a single purpose. An interface, like a class, should adhere to the single responsibility principle. An overly rich interface requires all classes that implement the interface, to implement all aspects of the interface, not just those that make sense for the class.

Basically, it is very easy to design an interface that "does it all". The problem is that now all classes have to "do it all" as well, even if it only makes sense for them to implement a subset of the interface. The solution often taken is to implement only the subset of the interface you need, resulting in a loss of type safety. All objects implementing the interface no longer have shared behavior.

This explains it far better than I can: http://en.wikipedia.org/wiki/Interface_segregation_principle

Study the SOLID principles. It is foundational, the way that design patterns are.

http://en.wikipedia.org/wiki/Solid_(object-oriented_design)

Keep reading. The text explains what it means.
Topic archived. No new replies allowed.