Do Not Wake the Programmer Up!


Hey there! I’m back from the first vacation in my life… and I guess that some people have not been on vacation in their entire life.

I’m not sure that it’s useful to take a break from work for almost a month. I haven’t realized what effect it would have on productivity. But during the holidays, I understood something about things I’ve been thinking about for a while, but couldn’t realize them.

I was always tormented by the following question. How to explain to people who have never done the kind of work I do, the idea of what happens in my head and heads of others like me when we work? How a NON programmer can imagine a programmer’s work and finally understand what happens there and what to do about it?

I think I understand it now. Maybe because I’ve been out of this process for almost a month, but still remembered that I had to get back to it soon.

Anyway, let’s get to the point.

How the Programmer Works

The work of a programmer is a DREAM.

Sounds ridiculous, right?

If you what to imagine what a programmer is doing during his work, the easiest way is to imagine it exactly like this. He’s sleeping!

The product of a programmer’s work is the product of dreaming – it’s a chimera. It’s a dream recorded by a special language and transmitted to an electronic device, so that it would last when the programmer is awake or simply changes one dream to another.

You think that a programmer takes a task, writes a program, and that’s it! The problem’s solved. But it’s not like that at all.

If we take, say, a task to find a way out of the labyrinth. In this task, the programmer is not an imaginary finger that leads an imaginary little girl to the exit. He is not the girl, and not the walls of the labyrinth. He’s not the way out to be found. He is all of this.

To solve the problem, the programmer has to become the labyrinth, the way out, the imaginary little girl, the imaginary finger that leads her somewhere; he’s also the stones that she throws to know the places that have already been to. All of this is a DREAM the programmer has during his work.

I’m not talking figuratively. It is LITERALLY a dream. When solving the task, the programmer virtually lives in the created world of chimeras that are somehow similar to the terms of the problem being solved.

Watching a working programmer is the same as watching a sleeping person. When you decide to go to sleep, do you immediately fall asleep?

For most people, the process of falling asleep is a certain ritual that is short for some of them, and can be long and complicated for others. For some people, it is necessary to read before bedtime. And someone cannot fall asleep unless he does thirty sit-ups before going to bed. One way or another, no one falls asleep in a split second. Although, I think some people can do so.

The same thing happens in programming. The process of getting started is the same. The programmer can not just sit down and start to work. Just like you can not say to yourself “Sleep now!” and pass out immediately. Just like the ritual of falling asleep, the process of programming has no general way.

Someone counts sheep, and someone dreams up. Someone focuses on breathing, while other people just drink chamomile tea.

Besides, all of this changes with time. Today, you can go to bed and have sweet dreams in a really short period of time. But you can toss and turn for hours the next day. The same is true for the work of a programmer. It’s literally the same thing.

So what can we do about this?

Well, let’s say so. If you are NOT a programmer and are somehow interested, directly or indirectly, that the programmer produces something useful, you’d better understand all of this, at least to some extent.

Just imagine that your life and the life of your children, and everything else depend on your sleep. Imagine that the fact whether your children will go to university or not, will depend on the quality of your sleep. Imagine that the lives of passengers on a plane, the quality of service in stores, and the contents of your pocket depend on how beautiful, successful and complete your dreams are.

Can you imagine?

That’s exactly how it looks to us, programmers. Word for word.

It just seems that you came up and asked the time.

What if I come to you at 3 a.m. and ask the time?

What’s wrong? So what if you just fell asleep?

I just ask, you answer and can go on sleeping. What’s wrong about that?

I hope it’s more clear now.

Imagine that EVERYHTING depends on your sleep. The quality of your sleep will affect everything. Everything! Will your daughter get married or not? Will your son become a loser or a successful person?

Imagined that?

And now, you’re going go to sleep. It’s SO important for you, as EVERYTHING depends on it, and you realize this.

Tell me now. How about sleeping and help your son out of the corner of your eye at the same time? Watch TV or go to the shop, just a little bit?

Having sweet dreams now?

Now, think what happens to the programmer if you ask him for help two of three times per hour, or remind him not to forget about something?

Could you endure this EVERY DAY?

Every day you go to sleep KNOWING that everything, and even more, depends on it. And all the asking, reminding and talking happen during your sleep. Imagine that it happens every night. How do you like this kind of life?

Do you want it?

But it’s not so tragic. Of course, there are people able to doze off all the time. There are drivers ready to take a nap at every traffic light. Well, you know, we have to beep to bring them back to life. I’m sure you’re familiar with this situation.

Well, there are such programmers. They are always in a state close to sleep. As soon as people leave them alone, they fall asleep at once. Just for a little while. You won’t be able to dream serious chimeras during such sleep, just some vague and hazy ones.

That is exactly how most of the software products are created. They are made by people who either do not understand what they’re doing, or by those who cannot fall asleep deep enough. Well, you might have guessed about the quality of such products.

Because programmers are constantly distracted by everyone. Because people AWAKE them all the time! Because people do not understand that you’re sleeping and their “organizational” activity distracts you from working, damn it! Most people, who are NOT programmers, don’t understand this.

I hope now, when people know the analogy between the work of a programmer and sleeping, they will understand how to treat programmers and where nice programs come from. They will finally realize that this fucking LiveJournal is what I write and read BEFORE GOING TO SLEEP. Just like you. You cannot sleep until you read or watch TV, right?

Just like me. Before I get down to work, I need to read something, go to the toiler, brush my teeth, write something in my blog, etc. And if someone breaks this ritual, I will have to start all over again. Just like you have to count sheep if someone wakes you up after you’ve just fallen asleep.

Want nice programs?

Want your programmer husband to be successful and make all the money in the world?

Want your programmers to finally make everything right?

Well, here’s the secret:



  1. Thank you. It was beautiful.

Ropes — Fast Strings

Most of us work with strings one way or another. There’s no way to avoid them — when writing code, you’re doomed to concatinate strings every day, split them into parts and access certain characters by index. We are used to the fact that strings are fixed-length arrays of characters, which leads to certain limitations when working with them. For instance, we cannot quickly concatenate two strings. To do this, we will at first need to allocate the required amount of memory, and then copy there the data from the concatenated strings.