Every time my code spit out an error or didn’t work properly, I felt like I was idiot – that the computer was “right” and I was “wrong.”
This is extremely unhelpful, but I’m not the only one to have this reaction while learning programming.
There’s this saying that computers only do what you tell them to do. So if you get an error, you must have told the computer to do something wrong. After all, the computer is a precise machine of perfect logic, right?
What freed me from my counterproductive response to errors was realizing that I am not laying my code at the alter of some sort of perfect mathematical god and asking for their blessing. I realized that I’m working with things that other people made with a variety of goals and constraints.
A programming language implementation is itself a program. Features of that program may have been fought over, made on deadlines, meant to be fixed later, a joke, a personal preference, or just not that well understood. The rules of a programming language interact in complex ways that can be hard to foresee, even for the designers, and the interpreters and compilers that implement those rules may also have bugs of their own.
So when you come along and try to write your code in that language, you may get all kinds of weird and terrible and surprising effects. You can, with work and good documentation, usually figure out a bug, but a programming language is more like a very ugly pet that can do very cool tricks than a system of perfect sense and logic.
I don’t worry about being wrong so much anymore. Instead I think “how do I get this strange beast to behave the way I want it to?”
[…] My Ugly Pet – a blog post on coming to terms with coding by C. Susannah Tysor. […]
RT @scisus: My ugly pet http://t.co/Xuv4MhxCGW