Wednesday, September 07, 2011

What Programmers Do

If, in some cataclysm, all of scientific knowledge were to be destroyed, and only one sentence passed on to the next generations of creatures, what statement would contain the most information in the fewest words?

I believe it is the atomic hypothesis (or the atomic fact, or whatever you wish to call it) that all things are made of atoms—little particles that move around in perpetual motion, attracting each other when they are a little distance apart, but repelling upon being squeezed into one another. In that one sentence, you will see, there is an enormous amount of information about the world, if just a little imagination and thinking are applied.

A little research shows that pondering this question isn't a new idea. With that said, shortly after I read the above quote, I started thinking what the one statement I'd want to pass on to programmers if such a cataclysm was upon us. After rolling this over in my head, here's what I've come up with:

A programmer's job is to create abstractions. An abstraction should have the following properties:

It should be concise yet, expressive to use.

The implementation should be hidden and irrelevant to the programmer using it.

The implementation should built using abstractions.

Hardly one sentence. And of course, it doesn't explain what an abstraction is (it could be a function, class, macro, word, definition, etc. depending on the programming language you're using). Still, I think the above does capture what programmers strive to do - whether they are writing assembly code, or working with jQuery.