Track 07 of 12 · From bits to functions

Programming & Data Representation

Build a precise model of how programs represent integers and structured state, then use it to reason about scope, aliasing, mutation, pure functions, and recursion. Language-specific behavior is called out where no universal rule exists.

Ten concepts, in learning order

Each lesson assumes the ideas above it and prepares you for the ones below.

  1. 01Bits, bytes, and integer widthA bit has two possible values, while a byte is the smallest independently addressable storage unit in a machine model and is eight bits on nearly all modern general-purpose systems. An integer's width is the number of bits in its representation and determines its finite set of bit patterns.
  2. 02Binary representationBinary positional notation represents a non-negative integer using powers of two and the digits 0 and 1. A stored bit pattern acquires a more specific meaning only when interpreted with a width, type, and encoding convention.
  3. 03HexadecimalHexadecimal is base-16 positional notation using digits 0–9 and A–F. One hexadecimal digit represents exactly four bits, making hex a compact, reversible notation for binary data.
  4. 04Bitwise operatorsBitwise operators transform integer bit patterns position by position: AND keeps shared set bits, OR combines set bits, XOR keeps differing bits, NOT complements bits, and shifts move positions. Exact width, signedness, and shift behavior are language- and type-specific.
  5. 05EndiannessEndianness is the order in which the bytes of a multi-byte value are arranged in memory or a serialized representation. Big-endian places the most significant byte first; little-endian places the least significant byte first.
  6. 06Variables and scopeA variable is a language-defined binding between a name and a value, storage location, or object reference. Scope is the region of program text or execution context in which a particular binding can be resolved by that name.
  7. 07Value vs reference semanticsWith value semantics, copying a value produces independently changeable state at the abstraction level of the type. With reference semantics, copying a reference can create another alias to the same object, so mutations through one alias are observable through the other.
  8. 08Mutable vs immutable dataA mutable object's observable state can change while retaining its identity; an immutable value cannot be changed after construction, so an apparent update produces or selects another value. Whether a type is mutable is defined by its language and API.
  9. 09Pure functionA pure function's result is determined only by its explicit inputs, and evaluating it causes no externally observable side effects. A call can therefore be replaced by its result without changing program behavior in the relevant model.
  10. 10RecursionRecursion is a computation in which a function or definition refers to itself directly or through other functions. A terminating recursive algorithm needs reachable stopping cases and recursive steps that make progress toward them.

Continue the curriculum

Next: How Programs Run

Follow source code into calls, memory, execution engines, types, and object design. The track replaces misleading either-or slogans with mechanisms that hold across modern compilers, interpreters, virtual machines, and runtimes.

Open track 8