Saturday, April 10, 2010

Viewing programming as constraint satisfaction

Programming could be viewed as solving a constraint satisfaction problem. We start with some empty disk space and the goal is have a program there. Only the goal state is important. We are not searching for a path. We are searching for a goal state that meets the constraints.

I could view my programming as an attempt to solve the problem efficiently. Modifying existing source code is like a mutation in a local search. Hitting an unexpected constraint and choosing a different path is like backtracking. And rewriting allows me to get rid of old constraints.

A super intelligent machine may laugh. It will see the inefficiency of my primitive attempts. I would seem like a 19 month old baby.