Intel's Ronler Acres Plant

Silicon Forest
If the type is too small, Ctrl+ is your friend

Sunday, April 3, 2016

Programming


How a watch works ; Mechanical movement

Programming is so weird. You write thousands of characters and they all have to be just so or your program won't work. For instance, I ran into a problem that I could not solve, so I excerpted the offending section and posted it on the Go Language Help Forum:
I thought I had a simple expression in an if statement:if c2c >= (r2 + r2) {but I couldn't make it work until I replaced (r1 + r2) with a single variable.
https://play.golang.org/p/juhYJaoq5p6Am I missing something?
The sharp eyed among you will notice that inside the parentheses, inside the box I refer to the variable r2 twice, whereas in the following text I use two different variables. Doh! Kind of a crucial error. (the > is supposed to be an a 'greater than' sign. It may look like one by the time you see this.) I couldn't fix this problem because I literally didn't see it.

There are some errors that the compiler will catch, like if you misspell a variable name. For instance, if I had typed 'r3' instead of 'r2', the compiler would have complained, but only if I had not created variable r3. And in some cases you can transpose expressions, or lines of code and even whole sections, and the program will run just fine. I liken it to virtual watch making. The only parts that matter are the working bits, and those have to be absolutely right.

Quora has a good post about this.

Update April 2018 replaced missing video with something similar.

No comments: