Writing Generic Procedures
If a procedure is to be generic, i.e. reusable for a
variety of data representations, it must make minimal
assumptions about its data:
Any assumption in a generic procedure
becomes a requirement when the procedure is reused.
- The language syntax must not reflect the form of data.
- The generic procedure must not make
assumptions about whether data is stored or computed.
- The generic procedure must not make assumptions about
numeric type ( e.g. real or integer)
or units of measurement.
- There must be structure-independent ways to write and
create data, as well as to read it.