What is the purpose of thinking ahead?
to make programs easy and intuitive for users to use
What is the definition of an input?
data that is required to solve a problem, usually entered into the system by the user
What is the definition of an output
results passed back when inputs have been processed and the problem is solved
What 3 considerations do programmers need to make about inputs and outputs when thinking ahead?
What are preconditions?
requirements which must be met before a program can be executed
What 2 places can preconditions be defined?
within the code or documentation
What are 2 examples of where preconditions are required?
What 2 ways does a stack function make use of preconditions?
How does a factorial function make use of preconditions?
checks the number passed into the function is not negative
What are 3 advantages of including preconditions within the documentation accompanying a subroutine?
What is the definition of caching?
the process of storing instructions or values in cache memory after they have been used, as they may be used again
How is caching used in storing web pages?
web pages that a user frequently accesses are cached, so next time they are accessed, content can be loaded without delay
What are 3 advantages of caching web pages?
What is prefetching?
where algorithms are used to predict what instructions are likely to be be used soon
What are 2 limitations of caching?
What are 2 advantages of using reusable program components?
What are 3 examples of reuseable program components?