Let's think about what lessons we can draw from this experiment.
The ability to use a function without having to know how it is implemented (and conversely, the ability to write a function without having to know how it will be used) is what makes writing large programs possible. There are a number of reasons for this.
You should adopt this approach in your own programs. When you approach a problem, first determine how it can be broken down into a main program and a collection of functions (and, as we will see in the next lesson, subroutines). Decide on the interface of each piece. Then work on one piece at a time, getting it to work properly (with stubs if necessary). Finally, put the pieces together and iron out any final problems.
There is one final thing that I'd like you to notice. In the original interface I said that the parameters to SOLVE were P and Q. In the final version of SOLVE that I gave you, notice that the parameter names are A and B. The exact names of the parameters of a function do not matter when you are calling a function. Be sure that you understand why.
Hamlet Project