<a> The step <iii> is most meant to "write a program" but a simple translation process.
<b> To write a program is similat to build a building. One needs to specify precisely what the program is suppose to do.
|Vague idea||->||precise description|
A precise set of instructions that leads to a solution.
A mixture of oral languate and a programming language to describe a algorithm.
Algorithms are instructions for doing something.
data are the information manipulated by algorithm.
(1) 萃取程序中必要的部份(procedure abstraction)
Abstracting away or hiding from the irrelevant details.
eg. To watch the TV, one doesn't need to know TV works.
<i> Precondition for input of function a statement giving condition that is support to be true when a function is celled.
<i> Postcondition for output of function
A statement decribing what will be true when a function call is completed.
int days (int year) // Precondition: the parameter year is between // 1800-2001. // Postcondition: the return value is the total days // of the year.
<a> When to write the precondition and postcondition, specify the precondition and postcondition when writing the function's prototype.
<b> Precondition and Postcondition are the interface specification of functions. They are even more important when a group of programmer work together.
eg. They are the precondition/postcondition contract agreed by all programmers.
(3) Pitfall: failing to ensure the precondition. Wheneven it is possible, always check if the precondition is meet; even sometimes it is impossible.
(4) Assert function, in <assert.h>
assert( ( i > 5) && ( i < 10 ) );=> if it is true no action is taken.
A description of how each part of the documentation should be written.
<a> The typical cost of maintenance >> the cost of producing the original system.
<b> The majority of systems programmer's time is spent on the maintenance of exising system, not designing completely new systems.