liveBook · Manning

Context switching

As explained in The Creative Programmer

The shift from one active task, system, language, or conceptual framework to another, including the effort required to resume the original context.

Context switching is the shift from one active task, programming language, system, or way of thinking to another. The switch may be quick, but changing concepts can leave the mind briefly searching for the right rules again. section 5.4.1 section 7.3

When familiar rules collide

A programmer moving among C, Java, Kotlin, Python, JavaScript, and Go may suddenly forget whether a collection needs add() or push_back(), confuse zero-based and one-based indexing, or rely on garbage collection while working with pointers. These slips do not necessarily show ignorance; they show competing contexts fighting for attention. Verification and preparation help restore accuracy. section 5.4.1

An interruption resembles a CPU interrupt: notice what arrived, identify its source, decide whether to handle it, switch efficiently, and resume the earlier work. Creative work makes the cost especially visible because an interrupted idea can disappear, while returning to the original task may require about twenty minutes of recovery. section 7.3

Reduce the cost of switching by treating attention as something to protect:

  • Work in intervals of about twenty-five minutes, then take a five-to-ten-minute break; after four intervals, take a longer break. section 7.3.1
  • Close email or remove other distractions when a task requires sustained thinking; a fast switch is not automatically a cheap switch. section 7.3.1
  • Set goals and monitor progress, while checking whether organizational goals add overhead instead of reducing it. section 7.3.1
  • Prepare demonstrations and verify details when moving between languages or paradigms rather than trusting familiar habits. section 5.4.1
Figure 7.4 A crashing stream of thought illustrating the potential loss of ideas
CH07_F04_Groeneveld

Use the crashing stream-of-thought illustration to visualize how an interruption can scatter ideas and make resumption harder. section 7.3

How The Creative Programmer covers it

How deep it goes
Explains cognitive costs through CPU and train-of-thought analogies, gives timing practices, and stops short of definitive productivity claims.
Examples
Uses cross-language syntax slips, CPU interrupts, a crashing train of thought, email during builds, and timed work intervals.
What it assumes
Assumes ordinary programming experience, while teaching the cognitive effects of interruptions and paradigm changes through familiar analogies.
What you can do after
Apply it via the Pomodoro technique, distraction reduction, goal monitoring, preparation, and deliberate verification during language changes.
How it connects
Connects context switching with interruptions, creative work, programming languages, productivity, goal-setting, and the Pomodoro technique.

Also explained in

Compare how 9 books explain context switching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Creative Programmer. The section links point to the parts of the book it draws on.