home/ atoms/ concrete-example-alongside-abstract-code

Showing concrete runtime values alongside abstract code eliminates the need to mentally simulate execution

Victor’s binary search demo shows abstract code on one side and concrete runtime values for a specific example on the other, updating simultaneously as the code is written. When the programmer writes ‘low = 0,’ the right side shows ‘low = 0’ for the actual array. When they take the floor of the average, the bug (2.5 is not a valid index) appears immediately rather than after writing the entire function and running tests. The insight is that skilled programmers are praised for their ability to ‘play computer’ — simulate execution mentally — but this skill is a workaround for tool failure, not a genuine cognitive virtue. Making the computer show its work eliminates an entire class of programming errors by making them visible at the moment they occur.

Examples

In Victor’s demo: ‘Function binary search, takes a key and an array. Such as what? Give me an example.’ The system asks for concrete input and then shows every variable’s value at every step alongside the abstract code.

Assessment

Explain why Victor argues that the ability to mentally simulate code execution (‘play computer’) is a compensatory skill rather than a genuine programming virtue, and describe one alternative that replaces this need.

“the people that we consider to be skilled software engineers are just those people that are really good at playing computer. But if we're writing our code on a computer, why are we simulating what a computer would do in our head?”
corpus · bret-victor-inventing-on-principle-cusec-2012-archive-org · chunk 2