Seven Bedtime Stories About Code

Once upon a time I wrote code to ferry packets of information from a radar antenna to a graphical display. I wrote this code because a company paid me money to do it, and because it made my manager smile and say “good job!” when I wrote it and it worked the way he wanted it to, and because I enjoyed writing code.

I was glad I got money, because I could use the money to rent an apartment and support my family, which made them glad. My manager was glad because his managers smiled and said “good job!”. That manager was happy because the good working code pleased the people from the Federal Aviation Administration who had contracted for it and ensured that they would contract for more software in the future. The people from the FAA were glad, because the President had tasked them with making air transit faster and safer, and getting the good working code meant that they made a good choice when they contracted with my employer.

The President tasked the people from the FAA with improving air traffic control, because the people who elected him wanted go and visit their children and their grandparents and their siblings and the people they had a crush on and very much wanted to see again. And also many people wanted to travel to other cities to work on their own projects that they would get money and recognition for. And all of these people wanted to not have to stand in long lines, and they wanted make these trips as quickly as they could without feeling scared of dying.

That good, working code made quite a lot of people happy.

Another time, I worked at a company to help them write programs that would help medical researchers manage clinical studies so that they could make new medicines so that people wouldn’t get so sick and so those people and their kids and husbands and wives and parents would be happy that they weren’t sick so much.

When I worked at this company I wrote some good, working code that I could use over and over again to solve problems more easily than I could have if I had to start from scratch every time. And this made me happy and less frustrated. So I wrapped that helpful code up into an imaginary box called a “library” and shared it with all the other programmers I knew.

The helpful code helped those other programmers so much that they were happier and less frustrated too, and they smiled and said “thank you” to me, and this made me even happier and made me want to write more helpful code.

Once, a long time ago, I started to learn two new programming languages that would make it easier for me to write good, helpful code. But some of the people I met who used one of the languages seemed angry and condescending a lot of the time. (“Condescending” means that they acted like they were better than people who did programming differently than they did). This made me not want to be part of that programming language community.

The people who used the other new programming language mostly seemed happy and kind and even a little bit silly. And this made me want to be happy and silly with them. So I used that language a lot, and learned a lot about it, and wrote a lot of code to help other people with it, and then I helped other people learn the language themselves.

A great many other programmers also wanted to be happy and silly and write code with this language. And sometimes the code they wrote was more silly than happy, and sometimes it was so silly that it turned out not to be so helpful after all, especially when the old programmers left and new programmers had to to work on it.

But many other programmers had ideas that were very clever and helpful indeed, and so quite a lot of projects made quite a lot of people happy using this happy, silly language. And so I think that if you want to have as much help as you can get, it’s good to be happy and kind and a little bit silly.

Once, a very long time ago indeed, there was a programmer who wanted to make good, helpful code. But all of the programs which were around back then had been made by people who did not want to share them. And so if this programmer wanted to make any of the programs better and more helpful, he first had to promise not to share them with anyone else.

This made the programmer sad and even a little mad. So he decided to write all-new programs from scratch, programs that he could share for free with anyone who wanted them.

You might think this programmer had no hope to recreate the work of hundreds of other programmers who had been working for years on these programs, at big companies that gave them lots of money.  But a funny thing happened. Being able to share their code made other programmers so happy, that they joined his cause and started helping him to write his new system of programs.

The new system grew, and grew, and more and more programmers helped because it made them happy. And soon many of the new, shared programs became even better than the old, not-shared programs. And new programmers started writing programs on top of the shared programs.

One programmer wrote a whole operating system using these shared programs, just for fun! An operating system is the program that starts all the other programs on your computer.

But these new, shared programs didn’t just make programmers happier. They grew, and grew, and got better, and better, and they filled the whole world! They helped people all over the world do things that made them happy, like buying clothes, playing games, investing money, and writing poetry. In fact, some of those new shared programs that made programmers happy are helping you read this story, can you believe that? I certainly hope this story is making you happy too.


One day a programmer wrote some code that didn’t make her totally happy. It was code that did a good job. But she thought it looked ugly, and she knew that when code looked ugly to her that was often a clue that it would be hard to work on later. And she didn’t want to make her future self sad and frustrated with code that was hard to work on.

And so she wrote me a message, and showed me the code she had written, because she knew I had been writing ugly code longer than she had, and so I might have learned more about how to make it not-ugly. And since it makes me happy to help people and it makes me happy to make code less ugly, I worked with her on it. And because we both had similar ideas about what makes code less ugly, together we were able to change the code to look prettier to both of us. (Programmers often agree on what kind of code is pretty and makes them happy to look at, but not always!)

We were both happy to have made code that was pretty. And when later on, other programmers worked on that code, it made them happy too.

Of course, I don’t always write code to make other people happy. One day I was curious about whether I could solve a tricky problem in a clever way using code. And so I sat down to try and find out, because answering questions is one of the things that makes me feel good.

After a while I found out that I could, indeed, solve the problem in that clever way. It wasn’t a problem that anyone needed help with right at that moment, but just looking at the solution made me feel happy and satisfied.

Later I went upstairs from my office, and gave my wife a big smile and a kiss, and then I played video games with my kids for a while. My wife knows that solving problems is one of the things that gives me pleasure, so she’s happy for me when I’m able to do it. My kids don’t understand this yet, but that’s OK. They just know that they are happy when their daddy is happy.


One day an alien from a star very far away arrived in orbit around Earth. No one knew the alien was there, because its ship was very small and painted black.

The alien used powerful telescopes and other sensors to observe the people of earth. It saw that there were some humans who sat in front of computers all day, tapping away with their funny little human fingers (It had computers of its own, so it knew what one was).

The alien didn’t understand human symbols or language. But it had very special instruments that could tell what creatures of any kind were feeling. It could see that the humans were writing things on their computers which made them feel happy, or pleased, or just satisfied. And it could see that they shared those things with other humans, which made the other humans happier. And then those humans went on to do work which made still other humans happier.

The alien didn’t know if the humans were writing poems or algorithms. All it could see was that they worked day in and day out on things which clearly existed just to make themselves and other humans feel good feelings. And that is what the alien reported back to the other aliens who had sent it.

And that is the story of how the great and powerful Blortian Star Empire decided not to vaporize the earth.