Tales of the Rampant Coyote

Adventures in Indie Gaming!

Thinking in Code

Posted by Rampant Coyote on January 7, 2014

While I eventually received a formal education in computer science in college, for the first six years or so of my programming experience I was self-taught. I learned lessons from typing in other people’s code from the pages of books and magazines, and seeing all the different ways people approached similar problems. And of course, I wrote my own games. Partial, rarely-completed experiments that took me to the limits of BASIC programming and eventually into the realm of machine code.

I’ve never been truly fluent in a foreign language, in spite of two years of classes each of Russian, German, and Spanish. I have been told that as you are immersed in the language, you begin to think in it, no longer mentally translating back and forth between it and your native tongue. That’s how I became with code, before receiving any formal training in it.

I first became aware of this one night during a wind storm. I was having trouble sleeping, and my brain started going into this half-conscious overload, and I found that I was half-dreaming of mathematical formulas and procedural algorithms that could be used to simulate the swaying of the trees and their branches in the high wind outside. Not that it was genius math or anything – it was nothing that would have been passable on the screen of my Commodore 64 or anything. But my brain was subconsciously interpreting the world in terms of code.

Do most programmers end up thinking in code? It seems like it’s a natural result of familiarity and fluency with programming, but it does seem to drive a couple of my project managers up the wall: I think of solutions in terms of code and abstract data relationships and have trouble sometimes translating them into English. I always had problems in school (and afterwards) applying the correct names to things and relationships, as they existed in my head as fully-formed images without name, only descriptions. Sometimes I was delighted to learn the actual official term for such things, and the name stuck. Other times, not so much.

I assume I’m far from alone in this, but I don’t know that it’s something people talk about much. I think it’s more something you see evidence of as a software developer than anything else. Like the lack of comments of documentation. When you are writing the stuff, it’s all so natural and straightforward and obvious that it’s hard to imagine anyone (let alone yourself, two months later) might not look at it and immediately understand it all.

But code by itself is mere abstract math, meaningless in the real world. I could say all it does is shift numbers around, but even numbers are an interpretation of a bunch of “on” and “off” values. If you’ve worked with the C language a lot, you are probably all too familiar with how easy it is to cast those collections of bits to a different numerical interpretation. But the numbers themselves need context to have meaning, and without an implicit binding of context it can be pretty hard to read code, no matter how much you think in it.

In English, “He kissed her” is a sentence that could carry a large number of different meanings, but there is some implicit context that is carried with it. You read that, and you can immediately draw some assumptions, and start filling in the blanks in your understanding by looking at what precedes and follows the sentence.  By contrast “x2 = j+1;” does not carry much by way of contextual clues to help a programmer figure out the meaning of a block of code. Code is implicitly efficient, not human-readable. We need to perform tricks to help explain the relationship between the code and its meaning, like using more explanatory variable names.

But that’s merely a peculiarity of how the language works (and I’m combining lots of computer languages into one lump here), and not something that makes it fundamentally different from any other language. It would be interesting to find out if there’s some way to measure it. And then here’s another question: There’s a whole body of thought that suggests that language influences behavior and thinking. Does “thinking in code” change one’s behavior? I don’t think it’s turned me into a robot yet, but has a lifetime spent communicating with machines (and indirectly, with other programmers) in code almost as much as I communicate in English changed the way I deal with the world?

Filed Under: Geek Life - Comments: 15 Comments to Read

  • McTeddy said,

    Maybe I’m nuts, but I know that coding actually influences my thinking and behavior. I’ve developed two major traits from my adventures in programming.

    – I want to know WHY and HOW something happens. Marketing trends, game designs, music, or other languages… I study the logical of progression things.

    – I work on step at a time. Everything I do is divided into one instructional line of life-code at a time. When I finish step one, I move onto line two.

    Theoretically though, it’s possible that I was just born logical and that lead to me learning to code.

  • Felix said,

    And that’s why you never name your variables along the lines of “x2” or “j”. 😛 Also, in my experience, if the code is unclear, all the comments in the world aren’t going to help. If the code is clear, its purpose will also be obvious.

    As for foreign languages, in my experience you don’t ever start by translating in your mind. If you need to do that, you’re lost. Rather, you should think in the other language from the beginning, with whatever vocabulary you have at the time. And that pretty much means learning it from actual written material, and conversations — NOT the way they teach foreign languages in school. Tip: comics help a lot.

    All that said, I don’t think I’ve ever thought of the world in terms of code (except perhaps at one point when I was infatuated with POV-Ray). But I often find myself applying math naturally to the world around me, and I’m not even very good at math. And yes, that does make it hard for me to communicate sometimes, since math is very precise while most people think fuzzily at best. But I think that’s just giving me an advantage.

  • Rampant Coyote said,

    And that’s why you never name your variables along the lines of “x2″ or “j”.

    You do when j is a loop variable (yes, I still use i and j and occasionally k for loop variables) and x2 is the second X coordinate… 🙂

    I need to find some Russian comics, I guess… 🙂

  • OttoMoBiehl said,

    I tend to a little bit. I usually look at real world things and go, “gee, that would be a cool game mechanic,” and then imagine how it would be implemented in code.

    For some strange reason I’m enamored with game loops too. I’ll find my mind wandering all the time and find myself subconsciously trying to build a better game loop.

    I’m strange though.

  • Tom W said,

    I occasionally think in terms of code, but usually only in technical or scientific circumstances where it can help me understand a deeper concept.

    I don’t think that it would necessarily hamper communication in English, mainly because even if someone who speaks English is able to think in Russian (for example), it doesn’t detract from their ability to think in English as well. I guess it depends on the person.

  • Greg Squire said,

    I tend to do this a bit as well. Not sure if it’s something I’ve learned to do because I deal with code everyday, or if it’s because I’ve always been a logical, analytical person. Probably some of both. I’ve always been interested in the HOWs and WHYs things work. As a young boy I became interested in magic. Not because I liked performing the tricks and amazing people, but because I realized that I liked knowing how the tricks were done. I find myself sometimes looking at the world and breaking it apart and analyzing it. I can remember a time looking a tree blowing in the wind and I got thinking about the physics and inverse kinematics needed to simulate such in a virtual world. I’m always thinking about such things.

  • Jay K. said,

    A variable named “j” would very meaningful to Rampant Coyote. 🙂

  • Rampant Coyote said,

    And you. 🙂

    I’m always tempted to just keep letting j increment…

  • alanm said,

    Coding sure does change the way you think.

    For example, it makes you intolerant of ambiguity and ack of precision in communication. People will look at you like you’re crazy when you ask them to clarify what they mean by phrases like “please get me that thing by the chair”.

  • CdrJameson said,

    “People will look at you like you’re crazy when you ask them to clarify what they mean by phrases like “please get me that thing by the chair”.”

    Definitely yes, this happens to me all the time.

    Game design is probably more of an influence though.
    I seem to relate to the world by mentally making games of it.

    Recent designs include:

    Life Logistics Challenge!
    Strategy game where you have to meet all your time/place commitments. Difficulty levels controlled by number of children. Laughably easy mode is ‘none’.

    Planning Permission+
    Puzzle Game. Fit as many houses into an awkward shaped plot as possible while making sure nobody’s windows overlook anybody else.

    Historical Strategy. Run a Medieval monastery, with economic & agricultural management. Careful diplomacy required to avoid armed factions as there’s no violence.

    Fortunately development cost for games released only in my head are minimal.

  • Cuthalion said,

    I do this sometimes, usually if I’m trying to sleep after having just spent several hours programming. Trying to do that is generally a bad idea. 😛

    For me, it tends to be the if-elses that my brain uses to interpret the world during these episodes.

  • McTeddy said,


    I don’t know… but I think life is a poorly designed game. I’ve been thinking about dropping the subscription and finding a GOOD game.

    – There is so much waiting… The tutorial alone is 18 years!
    – It has a slow learning curve that revolves around punishing player mistakes.
    – There is far too much pay-to-win involved in every aspect of the design.
    – It’s full of Haxors gaming the system like con-men, identity thieves, and politicians.

    The only parts of life that I enjoy are the minigames like Game Development and random internet arguments.

  • MrValdez said,

    Yeah, this happened to me a lot. I think in code and sometimes, I have trouble translating it to a human-friendly language.

    Being a teacher and giving technical talks helped a lot in the translation though.

  • MrValdez said,

    Yeah, this happened to me a lot. I once dreamed of code, woke up, implemented it in less than a day and is surprised to find that it worked. My personal proof that people can think in code!

    Like you, I have trouble translating it to a human-friendly language. Being a teacher and giving technical talks helped a lot in the translation though.

  • Casper said,

    I can smell code and taste code. Code really does have a taste and smell – it is a bit like frangipani mixed with feces.