Imagine we wished to write a program which can calculate the square root of a number entered by the user. Sure, in reality, there are mathematical libraries we could use which already include code to do such a calculation for us. But what if that weren't there (or what if we had been the people in charge of originally developing that library).
We will use this as a case study in the stages of software development, trying to walk through the development together as a class. Several new program constructs will be introduced as necessary. This particular problem is not discussed in the book, but the program constructs are described in the associated reading.
Perhaps we should open up a file and start coding, but first the bigger issue is how we would even design such a process? In fact, we should first ask whether we even know how to do this by hand?
It turns out there is a clever method known as Newton's method which is remarkably effective. The idea is to take a guess. If that guess is correct, we could verify so by seeing if the square of that guess equal the original value. If so, than the guess is truly the square root. If our guess is not currect, we will improve it. Notably, if we compare the two values "guess" and "original/guess", we can be sure that the true guess lies somewhere in between those two. Therefore we can make a new guess, such as the average of those two, and repeat.
We started today's lecture without such a program. Hopefully, by the end we will have designed and implemented such a program. If so, we will later go back and post the final source code here, for review.