Multiple Perspectives, Single-Threaded Minds
So what do rabbit/duck images have to do with programming? Surely programming doesn’t require thinking in parallel. Or does it?
Consider this little flowchart, probably typical of an impromptu design sessions. Click on it to view it full size.
Notice that every time your eyes focus in on a box to read the words, the rest of the flowchart “disappears”. If you read another box, you can no longer read the first box. To go back to the spotlight analogy, when we read a box, we put the spotlight on that box to the exclusion of the other boxes. And then to understand the relationship between the two boxes, you have to “pull back” the spotlight so you can see both boxes simultaneously. But when you pull back far enough to see the relationship, the box details may be too dim to read any more.
Another example would be that moment when you are considering adding a variable to a method or function. Should it be a string or a double or an int? What is the scope of the variable? Will the information contained in that variable be useful in other parts of the program? Is the information held in that variable related to other information and should the related information be held by a single object instead of being multiple independent variables? Based on these global-level assessments of the role of the variable, we switch to the detail perspective and implement that variable, making sure we meet all of the language requirements.
These are examples of how we switch back and forth between detail perspective(s) and the global perspective when we are programming. The normal programming process is to write a little code (details), mentally verify that the code matches the desired program flow (global), write a little more code (details), mentally verify that the code matches the desired program flow (global), and so on, mentally switching back and forth between the detail perspective and the global perspective because of the single-threaded limitations of our brains.
IF we could think in parallel, we wouldn’t have this perspective switching issue. We would be able to design and develop both in the global perspective and detail perspective simultaneously. We would never need to switch perspectives because we would always be able to fully consider both perspectives all the time.
Instead, we are forced to limp along with our single-threaded consciousness, time-slicing our attention between detail and global perspectives.