# Programming is the New Math

Programming is the new math.

Mathematics was invented as a notation for the pencil and paper realm.

Computers allow 3D and 4D, but we cling to mathematics (at best 2D).

PLs are constrained by syntactic conventions

• grid of non-overlapping cells
• all PLs based on line/offset of cells
• … instead of (x,y) positions of overlapping elements.

Bret Victor espouses “kill math”1 but jumps from text-only notation to full-blown graphical notation.

There is a simple notation in between text-only and full-blown graphics.

# Syntax Evolution

• text
• text, rects, ellipses, lines (arrows)
• bitmap and vector graphics

# Calculators

Most PLs describe calculators

• one-in, one-out
• synchronous.

Originally, it was thought that computers were useful only for ballistics calculations (fancy calculators).

Computers have outgrown the calculator-only paradigm.

# Asynchronous vs. Synchronous

Text-only thinking leads to synchronous designs.

But, the world is asynchronous.

Example: human body’s autonomous system. Self 1 and Self 2.2 Consciousness is only a small portion of how a body functions. A body consists mostly of asynchronous processes.

Example: cooking recipes. “… while the potatoes cook, …”

Example: music notation — real-time, asynchronous (polyphonic), SonicPi3.

Example: driving an automobile and listening to the radio.

Example: riding a bicycle.

Example: walking.

Example: opening a door.

# Box and Arrow Diagrams

Box and arrow diagrams work well if they deal with asynchronous components.

Box and arrow diagrams are a “hard problem” if built using synchronous PLs.

# Concurrency

Distributed programming is the newer reality.

Concurrency is easy, but text is not a good notation for concurrency.

## Assembly Language for Concurrency

At best, we have assembler components for concurrency, but lack a popular PL for concurrency (HTML+JavaScript?)

## State of the Art

Current state of the art for concurrency:

• many stand-alone calculators
• dropped into envelopes to shield them from each other (threads)
• lots of accidental complexity due to use of text-only notation
• time-sharing
• memory-sharing

### Accidental Complexity

Examples of accidental complexity due to text-only thinking:

### Time Sharing

Time-sharing is an old-fashioned idea.

Meant to optimize CPU usage (CPUs were expensive in the 1950’s).

CPUs are cheap, now.

No need to optimize CPU time.

Programmer time is more important than CPU time.

### Memory Sharing

Memory-sharing is an old-fashioned idea.

Meant to optimize memory usage (memory was expensive in the 1950’s).

Memory is cheap, now.

No need to optimize memory.

Programmer time is more important than wasted memory.

# Newer Reality

Newer reality: distributed.

• many computers
• thin wires (low bandwidth) connections
• uptime not guaranteed to be high.

# Efficiency

## Rust

Main efficiency gains will come from optimizing distributed computers.

Rust can only optimize calculators.

Incorrect emphasis.

## WASM

Main efficiency gains will come from optimizing distributed computers.

WASM can only optimize browsers (client computers).

Incorrect emphasis.

## Big O

Important: UX — what the user experiences.

Not Important: CPU usage.

Big-O only analyzes CPU usage.

Incorrect emphasis.

Main efficiency gains will come from optimizing distributed computers, then, optimizing UX.

Example: A good spec defines user experience (response time). A good spec does not define CPU usage.

Analysis of CPU usage is Production Engineering. Cost reduction. This is not a 1st order effect. Make it work first, then optimize second.

Big-O made more sense when CPUs were expensive.

## Delusion

Delusion: Measurement makes right.

Just because we can measure something does not mean that “that is all there is”.

Example: we think of sound as a 2D plot on an oscilloscope, but sound is actually a 3D spherical wavefront that expands over time (4D).

Example: we think of Earth orbiting the Sun in an elliptical orbit, but in reality, Earth transcribes a helix (the Sun is moving, Earth is following).

The 2D oscilloscope plot and elliptical orbits are only useful approximations.

Everything is a fractal. Every problem can be subdivided further.

(further discussion: https://guitarvydas.github.io/2021/03/23/Everything-is-a-Fractal.html)

# The Stack

Current CPUs encourage the calculator paradigm.

The Stack used by CALL/RETURN is a global variable that tracks dynamic dependencies (https://guitarvydas.github.io/2020/12/25/The-ALGOL-Bottleneck.html

1. http://worrydream.com/KillMath/  ↩︎

2. https://www.amazon.ca/Inner–Game–Tennis–Classic–Performance/dp/0679778314  ↩︎

3. https://sonic–pi.net/  ↩︎