data type = set of values (atomic or structured) + collection of operations on those values

e.g. an int

e.g. an array

abstraction 🖌️

abstraction = hiding the details of how a system is built in favour of focusing on the high-level behaviours (i.e., inputs and outputs) of the system

e.g. C abstracts away assembly/MIPS code

e.g. Python abstracts away pointer arithmetic and memory allocation

e.g. a car’s steering wheel abstracts away the moving parts within the car’s hood

abstract data type (ADT) đź’˝

abstract data type = a data type which focuses on its high level behaviour, without regard for how it’s implemented underneath

programming by contact

pre-conditions = what conditions hold at the start of the function call

post-conditions = what conditions will hold at the end of the function

developing an ADT

  1. determine the interface in a .h file
  2. the “dev” builds a concrete implementation for the ADT in a .c file
  3. the “user” uses the ADT in their program (compile with it, even if they do not know how it is built underneath)

e.g. set ADTs