Question

In: Computer Science

What does “program to interfaces, not implementations” mean?

What does “program to interfaces, not implementations” mean?

Solutions

Expert Solution

Interfaces are just contracts or signatures and they don't know anything about implementations. Coding against interface means, the client code always holds an Interface object which is supplied by a factory. Any instance returned by the factory would be of type Interface which any factory candidate class must have implemented. This way the client program is not worried about implementation and the interface signature determines what all operations can be done. This can be used to change the behavior of a program at run-time. It also helps you to write far better programs from the maintenance point of view.


Related Solutions

What does it mean if the linear program exhibits unboundedness?
What does it mean if the linear program exhibits unboundedness?
What does it mean to run a program "in the background"? Specifically, what is the key...
What does it mean to run a program "in the background"? Specifically, what is the key difference between running a program in the foreground and in the background?
* What does it mean when header files are described as making a program “modular?” What...
* What does it mean when header files are described as making a program “modular?” What are the advantages of this? * You are testing a program that is designed to take in a pair of float values as input. The intended range is from -50.50 to 100.25. What are 10 test cases you would use to test this program, bearing in mind each test case is a set of two numbers? Briefly justify your choices.
What are abstract classes? What are interfaces? What is the difference?
What are abstract classes? What are interfaces? What is the difference?
What does it mean to have a good life? What does it mean to be a...
What does it mean to have a good life? What does it mean to be a good person?
What does it mean to be "modern" biologically and culturally? What does it mean to be...
What does it mean to be "modern" biologically and culturally? What does it mean to be human? Antropology 101
What does it mean to be operating a firm in the "long run?"  What does it mean...
What does it mean to be operating a firm in the "long run?"  What does it mean to be operating a firm in the "short run"?  What are the practical implications for managing a business if you are in "short run?"
What does it mean to have a critical lens? What does it mean to have a...
What does it mean to have a critical lens? What does it mean to have a gender/sex lens?
What does convergence of Technology mean to Apple? What does it mean to the customers?
What does convergence of Technology mean to Apple? What does it mean to the customers?
what does the acronym SBAR mean? what does the acronym ISBARR mean?
what does the acronym SBAR mean? what does the acronym ISBARR mean?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT