Why programs are hard to understand


When politics and computing mix, the results aren't usually pretty. Politicians have fundamental misunderstandings about computing, the internet and how computers and people interact; a fault which often causes them to enact useless or even harmful legislation. Senator Sam Brownback is pushing a bill that would force the people who rate video games to play the full game in order to render a rating. Ed Felten of Freedom to Tinker explains why this shows a complete misunderstanding of games, and computer science.

He writes, "Nonexperts are often surprised to learn that programs can do things the programmers didn't expect. These surprises can be vexing; but they're also the main reason computer science is fun." Felten gives an example of a simple Python script which even source code inspection wouldn't explain. It's only three lines, games run into millions of lines of code.

import sys, sha
h = sha.new(sha.new(sys.argv[1]).digest()[:9]).digest()
if h.startswith("abcdef"): print h[6:9]


Can you predict every possible outcome from these three lines of code? Would it ever print anything kids shouldn't see, like, for example, a four letter word?
Permalink | Email this | Comments

No comments:

Recent Posts