What does it mean when we say a programmer using a function should be able to treat the function like a black box?

a) This is meaningless. One must know how a function does its job to effectively use it.
b) One must be able to rely on the description of the preconditions (requirements for use of the function) and the postconditions (promise of behavior to use the function).
c) If one codes an application that uses a function with a knowledge of the internal mechanism of that function, then when the function’s maintainer changes its internal mechanism, the application programmer could be faced with changing the application code extensively.
d) The most efficient programs are the ones that each function is designed to maximally use the internal behavior of every other function to speed up the code.

b) One must be able to rely on the description of the preconditions (requirements for use of the function) and the postconditions (promise of behavior to use the function)., and c) If one codes an application that uses a function with a knowledge of the internal mechanism of that function, then when the function’s maintainer changes its internal mechanism, the application programmer could be faced with changing the application code extensively.

a) and c) are foils, explicit non-sense. Code that is written to exploit the internals of other functions is strongly coupled, and is nearly impossible to maintain. It may be fast, but there will be no way to replace one algorithm with another and retain well behaved code.

Computer Science & Information Technology

You might also like to view...

________ is a statistical hypothesis test that helps determine if samples of data were taken from the same population

Fill in the blank(s) with correct word

Computer Science & Information Technology

The amount of data actually transferred under real-life conditions is called _____.

A. ?latency B. ?throughput C. ?jitter D. ?bandwidth

Computer Science & Information Technology