how can computational problem be represented abstractly
input–> computational problem–> output.
INPUT: info relevant to a problem which can be passed as a parameter to a subroutine
OUTPUT: solution to the problem, which can be passed back from a subroutine
first step in constructing a solution to computational problem
clear statement of inputs and outputs and name in documentation
in order to make sure program doesn’t crash
specify preconditions with the DOCUMENTATION of the function eg len(list)>1
adv of specifying preconditions
CCR
Reusable libraries examples
why have own libraries
if have ABSTRACT data types eg queues: adding/deleting etc needed in lots of different modules so useful to have written, debugged and thoroughly tested code saving TIME
Caching
temp storage of data and program instructions recently used and may be needed shortly eg last few instructions of a program for fast retrieval. done AUTOMATICALLY by operating system
web caching
storage of HTML pages and images recently looked at. Gives fast access to pages recently looked at and saves using bandwidth unnecessarily as saves having to download pages again
benefits of libraries
pre tested and error free
saves time as it is ready for use
written by experts
can be written in a different language