chrisconley.io

Why Programming is Hard

It is estimated that the observable universe holds up to 1082 atoms. In comparison, there are 1050 atoms in the earth while you can hold roughly 1024 atoms in your hands. [1]

So yeah, 1082 is an unfathomably large number.

Converting that number to binary, we get somewhere around 2272 atoms. This is exactly the number of states that a 34 byte program could take.

01110101 01101110 01101001 01110110 01100101 01110010 01110011 01100101 01000001 01110100 01101111 01101101 01110011 00101101 00110001 00100000 00111101 00111101 00100000 01110111 01100001 01111001 01110011 01010100 01101111 01000110 00101010 01100011 01101011 01001001 01110100 01010101 01110000 00001010

In other words

universeAtoms-1 == waysToF*ckItUp

That’s a lot of ways to screw things up. In one line of code, there as many ways to configure those 1s and 0s as there are atoms in the universe.

In the universe.

From that vantage, it’s amazing that we’re able to effortlessly craft even a single line of code or complete programs 30 times the size, like the JS1k Competition. Not to mention incredibly complex software like Microsoft Office or Adobe Photoshop.

Credits

Joe Armstrong, one of the inventors of Erlang, got me noodling on software complexity when he related atoms to code complexity at StrangeLoop 2014. He has his own take on why programming is difficult as well.

[1] More info on the number of atoms in the universe, earth and a cup of water.