Posts Tagged ‘ understanding

What Programmers Do

So, what the hell do programmers do, anyway? I’ve noticed that a lot of people think that programming is a crazy obscure art that involves knowing all about 1s and 0s, and since it’s not, but it is really cool and important, I want clear up some common misconceptions that I’ve run across. Since everybody knows that programming is convincing the elves inside your computer to think what you want them to think, you might as well know how it’s done, right?

OK, so, the first common misconception is that programming languages are the ones and zeroes that computers understand, and that programmers write them with near-superhuman understanding. That was true in the late cretaceous period, but now we have real languages.

For example, consider the act of converting english speech into machine code, (the ones and zeros that computers understand) programming how to do that in machine code would be extremely difficult, but this is how you would do it in Python, a modern language:

for each_letter in sentence:
    print binary_code_for[each_letter],

That’s pretty clear, isn’t it? If you don’t know the language you probably don’t know exactly what’s going on, but it’s certainly not nearly as rough as hundreds of pages of 1s and 0s. It’s at least obvious that telling the computer that you want it to print the binary code for each letter. That’s real code, it works. (If you don’t believe me, you can view a full working version here.) A large part of being a good coder is making it easy for humans to read what you’ve written, so it’s not even like that’s different to how I should write it for myself.

I think that also gives a bit of an idea of what programmers do all day long: they write hundreds (and thousands) of lines of simple things like that, making them read as much like real english as possible, growing up systems a little bit at a time. Once you’ve got something built and working you can use it in other systems, and that’s why it’s possible for so much progress to happen so quickly. And that’s also why it’s possible for younglings to learn and do amazing things: programming languages are basically just extremely formal english, (or in some cases, limited drawing tools) with magic words that output to the screen or request input or solve impossible problems or any of the variety of other thinks that can be thought. Learning how to program is learning a small number of basic concepts, a slightly larger amount of basic syntax, and then blam! Magic.

Technorati Tags: , ,