A Model for Thinking About Communication

By way of summary, here’s a metaphor for thinking about the communication behavior that these studies document. We can think of a programmer as a thread scheduler in an operating system. The “algorithm” of a programmer’s work practice is sketched in Example 16-1.

To flesh out the metaphor, here’s a quick and dirty overview of how an operating system schedules threads. The scheduler keeps a queue of threads that are ready to run. It picks one and runs it until that thread gets blocked on input.[21] The blocked threads then get put on the pending queue until the input is available. Input arrives asynchronously in the form of an interrupt (for example, a network packet arriving or a disk block getting copied to memory). When input arrives, the scheduler finds the thread that was blocked waiting for that input and moves that thread from the pending queue back to the active queue. After handling the interrupt, the scheduler goes back to running a thread from the active queue.

Example 16-1. A developer’s day is like thread scheduling

void beProductiveProgrammer()
{
   while (!quittingTime)
      try {
         var task = readyTasks.pickOne();
         while (!task.isDone && !task.isBlocked)
            task.makeProgress();
         if (task.isBlocked)
             blockedTasks.add(task);
         readyTasks.remove(task);
      }      catch (Interruption interruption) {
         var info = interruption.informationContent;
         for (var task in blockedTasks)
            if (task.blockedOn(info)) {
                blockedTasks.remove(task);
                readyTasks.add(task);
            }
      }
}

This ...

Get Making Software now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.