Purposes of Interfaces
- create loosely coupled software
- support design by contract (an implementor must provide the entire interface)
- allow for pluggable software
- allow different objects to interact easily
- hide implementation details of classes from each other
- facilitate reuse of software
Analogy 2: Like you can plug various computer monitors into your home computer. You can plug a wall-size TV into it, an old CRT (the thick kind), a 20" flat screen, or a braille machine for the blind to "see" by touch. There's compatibility among these various/different devices and your computer because they all agree on interface standards.
Details of C# interfaces -- With C#/OOP interfaces you're doing the same kind of thing but in the unseen/virtual world.
You're correct about standardization, but also flexibility, scalability, extensibility, maintainability, reusability, testability and power.
(The more you use software interfaces the more these "buzz words" will be understood. And always consider interfaces in the real world because they have done us equally well.)
http://stackoverflow.com/questions/2026054/why-do-we-use-interface-is-it-only-for-standardization
No comments:
Post a Comment