When I was first introduced to mental visualization, I thought I couldn't do it because I struggled to clearly picture something as simple as an apple - or any other familiar object - in my mind. But with practice, the images slowly became clearer and more stable. Through continued practice, I was able to visualize more complex things, like text and even music sheets - which is kind of a cheat code, because you can memorize what you can visualize.
Something else I learned is that mental imagery[1] isn’t limited to just visual experiences. As a musician, I use it to hear intervals, hear the strong beat, hear chords, different timber / sound textures etc. You can also "visualize" smells, physical sensations, and more. I clearly see it as a skill that improves with time and effort.
One nice trick is being able to visualize conversations, dialogues, interviews etc. I believe it dramatically helped me overcome stress in those situations, as well as in performance.
Thanks for sharing this!
Do you have any additional resources that helped you achieving this? How long did it take you ? How much time did you invested ? If you can remember.
Unfortunately I never found much resources on how to practice it. I had this piano teacher who was fond of it and claimed being able to visualize the piano ( whole keyboard, how opened it was, the sheet stand, the texture of the keys etc. ), the sheet with its content for both hands, his hands, feeling his posture, feeling his feet on the pedals, feeling his hands move and hear the sound it should make.
I didn't achieve this level yet, but I'm 100% sure it's genuine, the guy could sing and play to prove he could see / hear / feel what he said.
Some learning process, applied to music were :
- Learning a tune with the music sheet away from the piano. The process is to imagine yourself playing it when you're looking at the music and try to hear it. Then, walk to the piano and try to visualize the sheet while playing it.
- The opposite : improvising and trying to visualize what you're improvising. At first you can just imagine the note on the staff, then enrich it with rhythm, putting it at the correct octave, add the left hand etc.. etc..
- Another one, which was quite crazy is that when you actually visualize a piece of music, you can try to play it in backward ( note and rhythm included ), or transpose it in your head and play it transposed.
As a matter of fact, this enabled me to learn some tunes in the train, and being able to play them with confidence the first time on the piano ( which is obvious because I had played them around 20x time in my head )
At this time I was playing around 6 to 8 hours a day, but I was able to actively work on that skill ~30 minutes a day, in the morning. I was unable to practice this when tired, or when I had drank alcohol the previous day, or when stressed. I also found that having a simple 10 minute meditation routine helped a lot focusing for this kind of work.
It took 1 month until I felt the first "improvements" and around 5/6 years until I could reliably use it. To this day I still thinks it helps me memorize faster and more reliably, and I feel like it gives me more ability to process stuff in my head. Consistency seem to be key for it to stick.
It’s absolutely amenable to practice, I agree. I don’t personally see it as an improvement to a cognitive ability like learning a concept/practice is, but rather as training yourself to notice. I’ve been known to infuriate many a (web-)philosopher of mind by insisting that aphantasia isn’t nearly as common as it seems to be based on self reports; instead, I think many people don’t have the ingrained tendency to notice the images present in the corners of their mind. The shakiness tells me it’s almost definitely an accidentally-evolved capacity, so they’re probably the more normal ones! Or natural, at least.
I do think there’s a better way to practice than this tho:
the best way for me to improve a visualization is to research all the different tools and diagrams out there
Namely—and I say this with complete seriousness-psychedelic drugs, above all else LSD. I’m very dubious of the Steve Jobs of the world claiming it changed their intellectual outlook, but in terms of resolving “visual noise” based on intentional parameters, it can’t be beat. That’s what LSD visualizations mostly consist of in the first place, and a lesser form of the effect lasts for months after one dose, and indefinitely (forever?) after regularish usage. It’s non addictive and has a brutally steep tolerance curve that lasts for 2-4w, so “regular usage” means once every few months for a year or two, not every day.
Long story short: if you want to be a better programmer, contact your local felon today! Surely y’all are cooler than me and have cool felon friends…
I personally have aphantasia, and, funny enough, I don't visualize anything when I'm coding, or reading code: I just understand the concept more or less deeply, but always without any images: It's just the "concept" that I understand. It's really like if I had an interpreter in my head when reading and when coding, I do the opposite: I know the required sequence and I reverse engineer it to the programming language version.
Many of us work the way you do, more or less of the time, and I think the fair term to use for that is fluency.
But I also think there are many working engineers, including some who have been in the trade for a very long time, that don't develop it.
There are surely other roads to doing good work without fluency, just like there is when forced to work in a foregin language with only modest proficiency, but I can't help but suspect it's a much more exhausting experience.
I think the title by itself suggests a different question than the article raises.
The idea of the article is that certain visualizations can help think through certain problems. Maybe you can hold these visualizations in your head, or maybe you can't (because your aphantasic, they're too complex, you're tired, whatever), but they're just as available to you on paper or in diagramming tools if you need them. It's trying to start a discussion about what helpful visualizations people turn to in specific problem contexts.
It's separately interesting to hear people try to characterize what they visualize in some generic/universal way, but I think it's causing a lot of people to self-diagnose as aphantasic when it's not indicated. You're not obliged to have some vague generalized visualization going on in your head when programming any more than you would be when speaking, or writing, or playing music. More commonly, one might draw on specific visualizations here and there as they enrich and relate to what you're expressing in your art.
I can't really picture things in my head in a visual way, but i can keep diagrams in my head as well as draw them to solve problems. What I often find weird is that some colleages cannot cooperate with me on such diagrams and others can. I guess the former hold structures in their head in a different (more textual or holding more in memory at once, i am not sure) way than I do.
I'm a designer by trade, programming is largely a hobby for me. By default I see things as pictures in my mind, I always have.
When I read something and it doesn't make absolute sense to me, I need to learn more about the context so that I can 'see' the whole picture and how it fits together. This means I can take a while to grasp something, but once I do I seem to have a better understanding of it than my peers - likely because I have that wider context.
I also have a tendency and desire to simplify the complex - which I think is a combination of my need to learn the detail in order to build that picture in my mind - and with my design background I can represent that well in reality.
In my corporate day job it means that I can take complex stuff and make sense of it, and provided I've got support to be brutal in cutting information to simplify the complex, generally what I do is easy for others to grasp also.
When working on a hard problem, I often had to visualize how the algorithm works, data moving there, changing this, replacing that. When I debug a tricky problem and I still have not figured it out yet, I have two options: either systematically note down what the code is going through, or keep the problem in the back of my head and sleep over it. More often than not, the solution will present itself after a while if I still bother with the problem. I reckon I can not solve all problems like that, but when my mind refuses to dig in, that is often the only effective way to solve the problem. Pushing harder only wastes time and risks saturation.
That really resonates with me! I’ve found that when I’m up against a tricky problem, the solution often pops into my head when I’m not actively thinking about it—whether I’m sleeping, going for a walk, or just doing something completely different. It’s like the answer appears out of nowhere after I’ve stepped away.
I’ve always wondered why this happens. Is it just how our brains work in problem-solving mode? Does anyone know of any articles or studies that dive into this? I imagine it’s not just a programming thing, but a general part of solving complex problems.
Julian Jaynes[1] makes a pretty compelling argument that our unconscious mind does pretty much all of the heavy lifting with regards to problem-solving. The conscious mind just steers us and lets us remember what we are doing.
If I recall correctly an example he gives is looking at a math problem. Looking at 2+2 as an adult you instinctively know it to be 4. As a child you may have had to count on your fingers or write out the problem until the abstraction of numbers was solidified for you, and now it is just a black box that your unconscious has added to a "tool belt" of sorts.
For me I would describe the process of learning/problem solving as my conscious mind navigating some solution/problem space and figuring out the general shape of it. Once I have figured out the shape of the problem, the answer either:
1. Immediately looks like the shape of another, solved problem. In which case I just use that solution.
2. Is not immediately apparent.
In the case of #2 I just play around with different strategies that mostly don't work, but it helps me build a mental model of the problem. Then I wake up in the middle of the night with a solution, or figure it out while I am showering/eating/driving/etc.
There must be a connection to how doctors advice to talk to (even unconscious) patients who survived a stroke: the brain of the patient is still actively receiving information and constantly rewires itself while trying to process the data over and over again. In case with a complex programming problem, the person itself is responsible for the 'feedback loop'. Like how you can't stop thinking about the problem under different angles. Thus no need for external stimulus. I'm guessing the best time for that kind of processing is when one is asleep because there is simply not much else for brain to do in that state. Plus, when asleep, some long-term memory mechanisms kick in which make the already processed data more accessible and easier to work with. If there are some studies explaining the why's, I bet the medical ones focusing on brain damage and long-term memory would be the most related.
I have that a lot. It seems my mind needs to try a lot of combinations and suddenly stumbles upon one that makes sense and a light lits up. Browsing through the code or reading the docs only tends to get in the way for that process.
There's the need for some noisy creativity to be able to try to match a lot of combinations including the non obvious ones, where the solution space is.
Yeah this is me too - which is why I enjoy turn based games while I’m coding, if I get stuck I distract my consciousness with 2-3 turns in Civilisation and the answer pops into my head while I’m playing.
Turn based is excellent because always I’m mid-turn when the answer comes so I alt-tab out and keep going.
My steam shows some ridiculous number of hours in game because it’s always on, nearly 24/7, in a window on my monitor
If I'm "in the zone", then I stop being aware of the monitor and keyboard and all I see is what's in my mind's eye: geometric shapes coming in and out of existence and moving in various ways that relate to what I'm doing. Then it feels like the code is just pouring forth on its own without me paying attention to it.
It's seriously an altered state.
Most of the time I'm not in that state[1], though. In those cases, I don't think I really visualize anything. I think my mind is too occupied with egg-juggling to have the cycles to spare on visualizing things.
[1] The older I get, the more difficult the state is to achieve and the more delicate it is when I've achieved it. Which is a shame because my best work is done in that state.
This happens to me also.
I have an unfounded, loose theory that this is when my left and right brain and in sync with each other - some days I'm more creative, others I'm more logical but when I'm in the zone I'm both of those things at once and everything 'clicks' together so easily regardless of what it is.
I don't even have to get in the zone for that, spatial relationships with various shapes (they're usually tagged blobs rather than geometric shapes; it's not something that could easily be made into an image to share with people) are just how I think about code in general. I switch from my normal "internal voice" style of thought to something different that usually doesn't use words, except occasionally for things like prepositions to help with relationships.
Really this is the same style of thought I usually have when I'm reading a book. Usually I don't have the entire thing mapped out like you'd see in a movie, just blobs that represent the characters and objects in the setting, but they're moving around and interacting as if it's a movie. If I get in the zone while reading this can temporarily override what I'm seeing so I don't even realize I'm still reading words and turning pages.
back in school the best basketball player in our conference was a quirky, affable guy who had little skill, athleticism, and never really exercised or exceeded the bare minimum at practice. he said what made him win was he pretended his entire family was going to be murdered by the opposing team if they won. then hed go out and outcompete everyone
Nothing, I'm too busy swearing at the computer and threatening to break it in various ways, until I realise I was missing a semi-colon, or I've misspelled a keyword, or any number of other reasons that make me a bad programmer.
Just the other day I wasted 20 minutes tracking down a problem before caving and pasting some code into Claude, running a massive machine learning model trained by the foremost researchers in the AI industry, all so it could tell me I forgot semicolons in some CSS import lines.
I thought we were done with such goofiness in the days of auto-linters and syntax highlighting, but that’s why it was so tricky! The cause is always the last thing you think to check, after all…
I try to visualize the dependency graph for my variables. I figure OoO cores and optimizing compilers are good enough nowadays that, as long as I don’t really mess things up too badly, the computer should figure out how to extract that ilp.
Or, as a special case if I am writing an MPI code, I try to imagine what in the heck the slowest process is doing while everybody else waits at the barrier.
I grew up as an electronic engineer designing actual computer hardware from the TTL level and beyond. Depending on what I'm programming, particularly with hardware interfaces and assembly or C, I think about the flow of the address and data lines as the code accesses chips and hardware interfaces. I see the address lines accessing a particular chip or port. I see the data going into and out of them.
I see nothing. I just select a scope and do a mental step-by-step simulation. I do one pass for expected inputs, and then a lot of passes for unexpected inputs. If anything I hold a stack of intermediate values in short term memory, but it's formless. It feels like a story. Since I stare at the code while doing it, you could say that some characters in the story are the relevant slices of code on the screen. If there's no code to stare at, like a planning thing, I write pseudo code or ascii diagrams regardless.
This describes my perception as well, I think. Except for me it’s more of a spatial system than a visual one. I recall things by how I got there - whether that’s a reference on a webpage or a variable deep in a callstack, it’s sorted in my head according to the path that brought me there. And then I have some fast lookups for “things nearby,” like maybe I can’t remember the exact file with a definition in it, but I can remember the text around it and know what to search for.
Maybe more block-diagram-ish than directed graph. Depends on the software.
I am not sure how this has evolved since I am doing VHDL/FPGA design, but especially there I have the actual block diagram of what I want to build inside my head and just have to "look at it" and type it out with my hands. When it's software, then it's similar. The path the data flows
I picture clusters of information as they move through the computer. Sometimes they look like ships or motorcycles. :-)
Usually, I don't visualize anything in particular. I use tools for visualization, but I prefer to think algebraically. If I work on a complicated system, programming to me feels like like moving through a landscape, with points of interest that I memorize or lay out spatially in a tool, and going through the motions like patching things together, flicking switches, plugging things in and out etc.
I would be interested in seeing someone working on an example problem and attempting to describe their inner thought process while doing it. Could be an interesting idea to compile a range of developers doing it with various day to day tasks they are already doing into a Youtube channel
Pretty sure I have aphantasia. So, I don't visualize anything. But, I do often imagine data structures and algorithms as ambiguous "things" at places and in motion. Can't see them. But, I can move them around and remember where they are. Like, imagining Bubble Sort as a shell game with your eyes closed.
I'd guess few people have much image-like things in their head for data structures or control flows or such. Such can be conjured if one tries to explain something visually by e.g. drawing. But 2D/3D structure is very limited for thinking about abstract stuff like programming.
I don't really have a recollection of or introspective access to what I experience when I focus on something like programming. And I guess many who claim they do are confabulating.
Id argue temporal/spacial reasoning encompasses ALL the reasoning we can do. After all, space time is the fabric of reality and encompasses all possible events
I'm in the same boat. No visual imagery but I do "see" abstract relationships and how they interact. I'm reminded of a case where a man had head trauma-induced blindness. He couldn't see colors, shapes, etc. But it turned out he could still see motion. He described it as black moving on top of black. It's sort of like that, somehow I experience the contours of the abstract relationships, but they feel very insubstantial.
I see semi-amorphous/semi-geometrical/semi-colored stuff that represent different aspects and components of system.
I think it's similar to people I've talked to about what they see when they think of the year+months+seasons, many friends described similar-ish types of representations that seemed visual (e.g. a circular view of months, or a long ribbon, etc.)
If months are circular for you, in which direction do they progress? A few years ago I realized my mental model of calendar months goes counter-clockwise. No idea why. I'm also aphantasic, so it's a sense of space and movement but I'm not actually seeing a circle. NYE is at 12 o'clock, but January is oddly at 11.
I've never thought about it before but mine is definitely counter clock-wise as well, though NYE can be either at 12 o'clock or 6 o'clock. Brains are weird things.
I never thought about it before, but I think I visualize stack frames. Local variables are registers or just memory in the stack frame. Objects are pointers. "Where I've been" is prior frames on the stack. "Where is this going" is branch prediction guesses the CPU is making. It's like having a sort of mishmash of Von Neuman architecture and algorithms and data structures rolling around.
This article starts talking about visualizations in head, but then the article becomes about common paper/screen visualizations from CS classes and programming tools.
There are visualizations in your head, and visualizations that you can look at and read and write. Unless you have a photographic memory, IME they're not used the same way.
For example, take their database schema diagram. The graph layout doesn't even make a lot of visual sense, and the visual language doesn't show the connections between columns and relations. But you can "read" through the column names (including the keys they put at top), and trace through the arrows, to see how to navigate to the information you need. And it summarizes important information in a small amount of space. All useful. But that's probably not how you see it in your head, and that's good.
When doing architecture work, I'm generally thinking in terms of data flows and state changes.
Programming seems more verbal to me than visual. It feels very akin to writing, I have an idea and I am talking through it. My editing of code tends to be nonlinear for this reason, drilling into areas as I would expound upon them verbally, rather than in the order the compiler will evaluate them.
Article focuses a bit too much on specific task visualizations (recursive loop, performance optimizing, etc.) I don't usually spend much time doing that though. Real work to me involves more holding a ton of less complex visualizations in your head simultaneously.
I am usually visualizing how data flows through 5+ functions that are strung together until it ultimately updates the UI/Database/whatever. Each function is a bit of context I need to store in my head, If I can hold all the context's in my head simultaneously then I can easily manipulate the code.
I always felt like a great engineer can hold more contexts at one time, but good code means you shouldn't need to.
I visualize the starting state of exposed functionality, the desired end state and the transition. Then implement the transition without forgetting to take note of everything this transition affects.
I can't easily visualize anything ever. When I'm programming, if I truly try hard, I can sort of "feel" my system architecture and bits flowing through it. It sort of resembles a simple computer architecture with multiple threads each with their own stack, building up stacks with function calls. Sort of like what you see when you get a traceback, but dynamic.
You possibly have aphantasia (https://aphantasia.com/study/vviq/). I certainly do, and visualize nothing while programming. I often have to sketch block diagrams on paper to give me a foundation.
To answer TFQ: it depends upon how much I "squint": I normally see DAGs, but include cycles if I'm zooming in, or just linear pipelines if I'm squinting my mind's eye.
Kind of like Drakon, filtered through both Iverson and Dijkstra, but in landscape chunks.
Are we including the program itself as graph-like data? A well-structured program is usually a directed graph. Blocks are the vertices, control flow the edges.
my first set theory class in college ruined me. All I saw were sets. The class was taught using graphs too so it was very visualizable
then I took group theory and became a hippy that believes every problem has multiple perspectives you can see it through that have their own strengths and weaknesses and there's no one true perspective
I "see" the code, but I'm not sure that I actually see anything. Maybe some kind of shapes, but they don't correspond to UML diagrams or anything. Maybe vaguely 3D blocks? But I'm not really thinking visually, so I'm not really looking at them as shapes. All I can say is that I think there is some spatial thing going on, but I can't tell you what it is.
I don't have aphantasia, I can easily imagine things when I want to, in fact I used to paint, it's just that when I am thinking, or doing any sort of intellectual work, I find visualizations more of a hindrance than helpful.
I also don't have an inner monologue unless I explicitly opt to, which I only very seldom do.
As a side note, I find most diagrams a waste of my time, more often a deterrent to understanding. I have always had great trouble producing diagrams for others, at work.
I squishy spheres connected with tubes of its oo. If it's functional with combinator style I don't see anything but the characters because there are so few I don't need to imagine anything.
The bastard in QA sitting in front of my “finished” program twirling his mustache.
Also, the meeting after launch where the client/users go to use the features I’m making. Their complaints. Their workflow issues. Performance bottlenecks.
Nothing. For complex algorithms, I prefer to think in invariants: "this condition should hold here, so this variable must be that".
I guess, for me the only exception is the dynamic programming algorithms. I re-discovered the wave algorithm (aka Dijkstra's algorithm) for solving mazes while writing in BASIC at school, and since then, I tend to reformulate any dynamic programming task as a path search in a maze.
When I was first introduced to mental visualization, I thought I couldn't do it because I struggled to clearly picture something as simple as an apple - or any other familiar object - in my mind. But with practice, the images slowly became clearer and more stable. Through continued practice, I was able to visualize more complex things, like text and even music sheets - which is kind of a cheat code, because you can memorize what you can visualize.
Something else I learned is that mental imagery[1] isn’t limited to just visual experiences. As a musician, I use it to hear intervals, hear the strong beat, hear chords, different timber / sound textures etc. You can also "visualize" smells, physical sensations, and more. I clearly see it as a skill that improves with time and effort.
One nice trick is being able to visualize conversations, dialogues, interviews etc. I believe it dramatically helped me overcome stress in those situations, as well as in performance.
[1] https://plato.stanford.edu/entries/mental-imagery/
Thanks for sharing this! Do you have any additional resources that helped you achieving this? How long did it take you ? How much time did you invested ? If you can remember.
Unfortunately I never found much resources on how to practice it. I had this piano teacher who was fond of it and claimed being able to visualize the piano ( whole keyboard, how opened it was, the sheet stand, the texture of the keys etc. ), the sheet with its content for both hands, his hands, feeling his posture, feeling his feet on the pedals, feeling his hands move and hear the sound it should make.
I didn't achieve this level yet, but I'm 100% sure it's genuine, the guy could sing and play to prove he could see / hear / feel what he said.
Some learning process, applied to music were :
- Learning a tune with the music sheet away from the piano. The process is to imagine yourself playing it when you're looking at the music and try to hear it. Then, walk to the piano and try to visualize the sheet while playing it.
- The opposite : improvising and trying to visualize what you're improvising. At first you can just imagine the note on the staff, then enrich it with rhythm, putting it at the correct octave, add the left hand etc.. etc..
- Another one, which was quite crazy is that when you actually visualize a piece of music, you can try to play it in backward ( note and rhythm included ), or transpose it in your head and play it transposed.
As a matter of fact, this enabled me to learn some tunes in the train, and being able to play them with confidence the first time on the piano ( which is obvious because I had played them around 20x time in my head )
At this time I was playing around 6 to 8 hours a day, but I was able to actively work on that skill ~30 minutes a day, in the morning. I was unable to practice this when tired, or when I had drank alcohol the previous day, or when stressed. I also found that having a simple 10 minute meditation routine helped a lot focusing for this kind of work.
It took 1 month until I felt the first "improvements" and around 5/6 years until I could reliably use it. To this day I still thinks it helps me memorize faster and more reliably, and I feel like it gives me more ability to process stuff in my head. Consistency seem to be key for it to stick.
It’s absolutely amenable to practice, I agree. I don’t personally see it as an improvement to a cognitive ability like learning a concept/practice is, but rather as training yourself to notice. I’ve been known to infuriate many a (web-)philosopher of mind by insisting that aphantasia isn’t nearly as common as it seems to be based on self reports; instead, I think many people don’t have the ingrained tendency to notice the images present in the corners of their mind. The shakiness tells me it’s almost definitely an accidentally-evolved capacity, so they’re probably the more normal ones! Or natural, at least.
I do think there’s a better way to practice than this tho:
Namely—and I say this with complete seriousness-psychedelic drugs, above all else LSD. I’m very dubious of the Steve Jobs of the world claiming it changed their intellectual outlook, but in terms of resolving “visual noise” based on intentional parameters, it can’t be beat. That’s what LSD visualizations mostly consist of in the first place, and a lesser form of the effect lasts for months after one dose, and indefinitely (forever?) after regularish usage. It’s non addictive and has a brutally steep tolerance curve that lasts for 2-4w, so “regular usage” means once every few months for a year or two, not every day.Long story short: if you want to be a better programmer, contact your local felon today! Surely y’all are cooler than me and have cool felon friends…
For the simple country folk, a cow or horse pasture may have exactly what you are looking for.
I don't condone picking unknown fungus from fields...don't go die from picking the wrong thing.
I personally have aphantasia, and, funny enough, I don't visualize anything when I'm coding, or reading code: I just understand the concept more or less deeply, but always without any images: It's just the "concept" that I understand. It's really like if I had an interpreter in my head when reading and when coding, I do the opposite: I know the required sequence and I reverse engineer it to the programming language version.
Do you guys really have schema in mind??
Many of us work the way you do, more or less of the time, and I think the fair term to use for that is fluency.
But I also think there are many working engineers, including some who have been in the trade for a very long time, that don't develop it.
There are surely other roads to doing good work without fluency, just like there is when forced to work in a foregin language with only modest proficiency, but I can't help but suspect it's a much more exhausting experience.
I think the title by itself suggests a different question than the article raises.
The idea of the article is that certain visualizations can help think through certain problems. Maybe you can hold these visualizations in your head, or maybe you can't (because your aphantasic, they're too complex, you're tired, whatever), but they're just as available to you on paper or in diagramming tools if you need them. It's trying to start a discussion about what helpful visualizations people turn to in specific problem contexts.
It's separately interesting to hear people try to characterize what they visualize in some generic/universal way, but I think it's causing a lot of people to self-diagnose as aphantasic when it's not indicated. You're not obliged to have some vague generalized visualization going on in your head when programming any more than you would be when speaking, or writing, or playing music. More commonly, one might draw on specific visualizations here and there as they enrich and relate to what you're expressing in your art.
I can't really picture things in my head in a visual way, but i can keep diagrams in my head as well as draw them to solve problems. What I often find weird is that some colleages cannot cooperate with me on such diagrams and others can. I guess the former hold structures in their head in a different (more textual or holding more in memory at once, i am not sure) way than I do.
I'm a designer by trade, programming is largely a hobby for me. By default I see things as pictures in my mind, I always have.
When I read something and it doesn't make absolute sense to me, I need to learn more about the context so that I can 'see' the whole picture and how it fits together. This means I can take a while to grasp something, but once I do I seem to have a better understanding of it than my peers - likely because I have that wider context.
I also have a tendency and desire to simplify the complex - which I think is a combination of my need to learn the detail in order to build that picture in my mind - and with my design background I can represent that well in reality.
In my corporate day job it means that I can take complex stuff and make sense of it, and provided I've got support to be brutal in cutting information to simplify the complex, generally what I do is easy for others to grasp also.
When working on a hard problem, I often had to visualize how the algorithm works, data moving there, changing this, replacing that. When I debug a tricky problem and I still have not figured it out yet, I have two options: either systematically note down what the code is going through, or keep the problem in the back of my head and sleep over it. More often than not, the solution will present itself after a while if I still bother with the problem. I reckon I can not solve all problems like that, but when my mind refuses to dig in, that is often the only effective way to solve the problem. Pushing harder only wastes time and risks saturation.
That really resonates with me! I’ve found that when I’m up against a tricky problem, the solution often pops into my head when I’m not actively thinking about it—whether I’m sleeping, going for a walk, or just doing something completely different. It’s like the answer appears out of nowhere after I’ve stepped away.
I’ve always wondered why this happens. Is it just how our brains work in problem-solving mode? Does anyone know of any articles or studies that dive into this? I imagine it’s not just a programming thing, but a general part of solving complex problems.
Julian Jaynes[1] makes a pretty compelling argument that our unconscious mind does pretty much all of the heavy lifting with regards to problem-solving. The conscious mind just steers us and lets us remember what we are doing.
If I recall correctly an example he gives is looking at a math problem. Looking at 2+2 as an adult you instinctively know it to be 4. As a child you may have had to count on your fingers or write out the problem until the abstraction of numbers was solidified for you, and now it is just a black box that your unconscious has added to a "tool belt" of sorts.
For me I would describe the process of learning/problem solving as my conscious mind navigating some solution/problem space and figuring out the general shape of it. Once I have figured out the shape of the problem, the answer either:
1. Immediately looks like the shape of another, solved problem. In which case I just use that solution.
2. Is not immediately apparent.
In the case of #2 I just play around with different strategies that mostly don't work, but it helps me build a mental model of the problem. Then I wake up in the middle of the night with a solution, or figure it out while I am showering/eating/driving/etc.
[1] https://en.wikipedia.org/wiki/The_Origin_of_Consciousness_in...
There must be a connection to how doctors advice to talk to (even unconscious) patients who survived a stroke: the brain of the patient is still actively receiving information and constantly rewires itself while trying to process the data over and over again. In case with a complex programming problem, the person itself is responsible for the 'feedback loop'. Like how you can't stop thinking about the problem under different angles. Thus no need for external stimulus. I'm guessing the best time for that kind of processing is when one is asleep because there is simply not much else for brain to do in that state. Plus, when asleep, some long-term memory mechanisms kick in which make the already processed data more accessible and easier to work with. If there are some studies explaining the why's, I bet the medical ones focusing on brain damage and long-term memory would be the most related.
I have that a lot. It seems my mind needs to try a lot of combinations and suddenly stumbles upon one that makes sense and a light lits up. Browsing through the code or reading the docs only tends to get in the way for that process.
There's the need for some noisy creativity to be able to try to match a lot of combinations including the non obvious ones, where the solution space is.
If you have not seen it I'd recommend watching Rich Hickey's talk on Hammock Driven Development: https://www.youtube.com/watch?v=f84n5oFoZBc
Yeah this is me too - which is why I enjoy turn based games while I’m coding, if I get stuck I distract my consciousness with 2-3 turns in Civilisation and the answer pops into my head while I’m playing.
Turn based is excellent because always I’m mid-turn when the answer comes so I alt-tab out and keep going.
My steam shows some ridiculous number of hours in game because it’s always on, nearly 24/7, in a window on my monitor
I don't think I can only play 2-3 turns of Civilization at a time.
Not gonna lie developing that discipline was really difficult …
If I'm "in the zone", then I stop being aware of the monitor and keyboard and all I see is what's in my mind's eye: geometric shapes coming in and out of existence and moving in various ways that relate to what I'm doing. Then it feels like the code is just pouring forth on its own without me paying attention to it.
It's seriously an altered state.
Most of the time I'm not in that state[1], though. In those cases, I don't think I really visualize anything. I think my mind is too occupied with egg-juggling to have the cycles to spare on visualizing things.
[1] The older I get, the more difficult the state is to achieve and the more delicate it is when I've achieved it. Which is a shame because my best work is done in that state.
This happens to me also. I have an unfounded, loose theory that this is when my left and right brain and in sync with each other - some days I'm more creative, others I'm more logical but when I'm in the zone I'm both of those things at once and everything 'clicks' together so easily regardless of what it is.
I don't even have to get in the zone for that, spatial relationships with various shapes (they're usually tagged blobs rather than geometric shapes; it's not something that could easily be made into an image to share with people) are just how I think about code in general. I switch from my normal "internal voice" style of thought to something different that usually doesn't use words, except occasionally for things like prepositions to help with relationships.
Really this is the same style of thought I usually have when I'm reading a book. Usually I don't have the entire thing mapped out like you'd see in a movie, just blobs that represent the characters and objects in the setting, but they're moving around and interacting as if it's a movie. If I get in the zone while reading this can temporarily override what I'm seeing so I don't even realize I'm still reading words and turning pages.
I visualize the tent my family will live in if I get layed off.
You should buy a really nice tent now while you have cash flow.
That might contribute to a self-fulfilling prophecy
Always have a rainy day fund, in this case for buying a good fly.
back in school the best basketball player in our conference was a quirky, affable guy who had little skill, athleticism, and never really exercised or exceeded the bare minimum at practice. he said what made him win was he pretended his entire family was going to be murdered by the opposing team if they won. then hed go out and outcompete everyone
Nothing, I'm too busy swearing at the computer and threatening to break it in various ways, until I realise I was missing a semi-colon, or I've misspelled a keyword, or any number of other reasons that make me a bad programmer.
Just the other day I wasted 20 minutes tracking down a problem before caving and pasting some code into Claude, running a massive machine learning model trained by the foremost researchers in the AI industry, all so it could tell me I forgot semicolons in some CSS import lines.
I thought we were done with such goofiness in the days of auto-linters and syntax highlighting, but that’s why it was so tricky! The cause is always the last thing you think to check, after all…
I try to visualize the dependency graph for my variables. I figure OoO cores and optimizing compilers are good enough nowadays that, as long as I don’t really mess things up too badly, the computer should figure out how to extract that ilp.
Or, as a special case if I am writing an MPI code, I try to imagine what in the heck the slowest process is doing while everybody else waits at the barrier.
I grew up as an electronic engineer designing actual computer hardware from the TTL level and beyond. Depending on what I'm programming, particularly with hardware interfaces and assembly or C, I think about the flow of the address and data lines as the code accesses chips and hardware interfaces. I see the address lines accessing a particular chip or port. I see the data going into and out of them.
I see nothing. I just select a scope and do a mental step-by-step simulation. I do one pass for expected inputs, and then a lot of passes for unexpected inputs. If anything I hold a stack of intermediate values in short term memory, but it's formless. It feels like a story. Since I stare at the code while doing it, you could say that some characters in the story are the relevant slices of code on the screen. If there's no code to stare at, like a planning thing, I write pseudo code or ascii diagrams regardless.
Layers of directed graphs where:
* Nodes can represent code units (lines, functions, AST) or some low level thing, even hardware parts.
* Can expand a node which contains other graphs
* Can group graphs into simpler graphs to describe a high level system design
* edges generally mean communications between graphs/nodes
This describes my perception as well, I think. Except for me it’s more of a spatial system than a visual one. I recall things by how I got there - whether that’s a reference on a webpage or a variable deep in a callstack, it’s sorted in my head according to the path that brought me there. And then I have some fast lookups for “things nearby,” like maybe I can’t remember the exact file with a definition in it, but I can remember the text around it and know what to search for.
This for me, too.
Maybe more block-diagram-ish than directed graph. Depends on the software.
I am not sure how this has evolved since I am doing VHDL/FPGA design, but especially there I have the actual block diagram of what I want to build inside my head and just have to "look at it" and type it out with my hands. When it's software, then it's similar. The path the data flows
I picture clusters of information as they move through the computer. Sometimes they look like ships or motorcycles. :-)
Usually, I don't visualize anything in particular. I use tools for visualization, but I prefer to think algebraically. If I work on a complicated system, programming to me feels like like moving through a landscape, with points of interest that I memorize or lay out spatially in a tool, and going through the motions like patching things together, flicking switches, plugging things in and out etc.
I would be interested in seeing someone working on an example problem and attempting to describe their inner thought process while doing it. Could be an interesting idea to compile a range of developers doing it with various day to day tasks they are already doing into a Youtube channel
I program with stack machines directly, so I visualize plates with numbers, names or things on them.
Pretty sure I have aphantasia. So, I don't visualize anything. But, I do often imagine data structures and algorithms as ambiguous "things" at places and in motion. Can't see them. But, I can move them around and remember where they are. Like, imagining Bubble Sort as a shell game with your eyes closed.
I'd guess few people have much image-like things in their head for data structures or control flows or such. Such can be conjured if one tries to explain something visually by e.g. drawing. But 2D/3D structure is very limited for thinking about abstract stuff like programming.
I don't really have a recollection of or introspective access to what I experience when I focus on something like programming. And I guess many who claim they do are confabulating.
Id argue temporal/spacial reasoning encompasses ALL the reasoning we can do. After all, space time is the fabric of reality and encompasses all possible events
I'm in the same boat. No visual imagery but I do "see" abstract relationships and how they interact. I'm reminded of a case where a man had head trauma-induced blindness. He couldn't see colors, shapes, etc. But it turned out he could still see motion. He described it as black moving on top of black. It's sort of like that, somehow I experience the contours of the abstract relationships, but they feel very insubstantial.
You can experience this easily yourself: https://en.m.wikipedia.org/wiki/Motion_aftereffect
Motion is separated from shapes and structure and objects changing place very early in visual processing, and it's kind of a sense of its own.
I see semi-amorphous/semi-geometrical/semi-colored stuff that represent different aspects and components of system.
I think it's similar to people I've talked to about what they see when they think of the year+months+seasons, many friends described similar-ish types of representations that seemed visual (e.g. a circular view of months, or a long ribbon, etc.)
If months are circular for you, in which direction do they progress? A few years ago I realized my mental model of calendar months goes counter-clockwise. No idea why. I'm also aphantasic, so it's a sense of space and movement but I'm not actually seeing a circle. NYE is at 12 o'clock, but January is oddly at 11.
edit: here's the article that prompted me to reflect on this https://nrkbeta.no/2018/01/01/this-is-what-the-year-actually...
I've never thought about it before but mine is definitely counter clock-wise as well, though NYE can be either at 12 o'clock or 6 o'clock. Brains are weird things.
what is this new trend lately of having aphantasia?
never read/heard this before from the HN audience.
bots are increasing on HN it seems.
I never thought about it before, but I think I visualize stack frames. Local variables are registers or just memory in the stack frame. Objects are pointers. "Where I've been" is prior frames on the stack. "Where is this going" is branch prediction guesses the CPU is making. It's like having a sort of mishmash of Von Neuman architecture and algorithms and data structures rolling around.
This article starts talking about visualizations in head, but then the article becomes about common paper/screen visualizations from CS classes and programming tools.
There are visualizations in your head, and visualizations that you can look at and read and write. Unless you have a photographic memory, IME they're not used the same way.
For example, take their database schema diagram. The graph layout doesn't even make a lot of visual sense, and the visual language doesn't show the connections between columns and relations. But you can "read" through the column names (including the keys they put at top), and trace through the arrows, to see how to navigate to the information you need. And it summarizes important information in a small amount of space. All useful. But that's probably not how you see it in your head, and that's good.
When doing architecture work, I'm generally thinking in terms of data flows and state changes.
Programming seems more verbal to me than visual. It feels very akin to writing, I have an idea and I am talking through it. My editing of code tends to be nonlinear for this reason, drilling into areas as I would expound upon them verbally, rather than in the order the compiler will evaluate them.
Same here. I start with high-level signatures and data structures. Then I implement the functions.
Perhaps the git diff helps me visualize what's left to do.
On the other hand, if it is a complex algorithm, I draw diagrams representing the edges cases and I try to give them names before coding them.
Maybe because programming per se isn't my occupation... I think about the problem that I'm trying to solve.
Article focuses a bit too much on specific task visualizations (recursive loop, performance optimizing, etc.) I don't usually spend much time doing that though. Real work to me involves more holding a ton of less complex visualizations in your head simultaneously.
I am usually visualizing how data flows through 5+ functions that are strung together until it ultimately updates the UI/Database/whatever. Each function is a bit of context I need to store in my head, If I can hold all the context's in my head simultaneously then I can easily manipulate the code.
I always felt like a great engineer can hold more contexts at one time, but good code means you shouldn't need to.
I visualize the starting state of exposed functionality, the desired end state and the transition. Then implement the transition without forgetting to take note of everything this transition affects.
Arranging deck chairs on the Titanic.
This one is hilarious
I can't easily visualize anything ever. When I'm programming, if I truly try hard, I can sort of "feel" my system architecture and bits flowing through it. It sort of resembles a simple computer architecture with multiple threads each with their own stack, building up stacks with function calls. Sort of like what you see when you get a traceback, but dynamic.
> I can't easily visualize anything ever.
You possibly have aphantasia (https://aphantasia.com/study/vviq/). I certainly do, and visualize nothing while programming. I often have to sketch block diagrams on paper to give me a foundation.
Nothing, I have aphantasia.
I don't visualize anything either, when programming, but I definitely don't have aphantasia.
Imagine not having a voice in your head. How are you gonna do rubber duck debugging within your head?
https://www.youtube.com/watch?v=u69YSh-cFXY
These are two common things I ask new friends so that I can communicate better with them (aphantasia and inner monologue).
A boulder at the bottom of a hill that I'm pushing up but the G.D. thing keeps falling down.
Don't fret — we must imagine you happy.
To answer TFQ: it depends upon how much I "squint": I normally see DAGs, but include cycles if I'm zooming in, or just linear pipelines if I'm squinting my mind's eye.
Kind of like Drakon, filtered through both Iverson and Dijkstra, but in landscape chunks.
Nothing except when I'm working with graph-like data, which isn't that rare.
Are we including the program itself as graph-like data? A well-structured program is usually a directed graph. Blocks are the vertices, control flow the edges.
my first set theory class in college ruined me. All I saw were sets. The class was taught using graphs too so it was very visualizable
then I took group theory and became a hippy that believes every problem has multiple perspectives you can see it through that have their own strengths and weaknesses and there's no one true perspective
Yeah, the only time I need to "visualize" anything while programming is when the output is something visual.
If I code too much all day and night and don't unwind before going to sleep, I dream code... just code text scrolling by endlessly in my dreams.
Where I am at in the call stack. Esp for back end api dev.
Reading about ML, I can't help but visualize dynamic pin art as being analogous.
i visualize a little version of a former manager sitting in my head
he asks me questions about the code i'm looking at, and my brain does its best to explain the logic to 'him' in plain english
any time i'm unable to answer something he 'asked', that's exactly where the bug is
Trees
All I see now is blonde, brunette, redhead.
I "see" the code, but I'm not sure that I actually see anything. Maybe some kind of shapes, but they don't correspond to UML diagrams or anything. Maybe vaguely 3D blocks? But I'm not really thinking visually, so I'm not really looking at them as shapes. All I can say is that I think there is some spatial thing going on, but I can't tell you what it is.
Retirement
Money
I don't visualize anything when I am thinking.
I don't have aphantasia, I can easily imagine things when I want to, in fact I used to paint, it's just that when I am thinking, or doing any sort of intellectual work, I find visualizations more of a hindrance than helpful.
I also don't have an inner monologue unless I explicitly opt to, which I only very seldom do.
As a side note, I find most diagrams a waste of my time, more often a deterrent to understanding. I have always had great trouble producing diagrams for others, at work.
Tensors
I squishy spheres connected with tubes of its oo. If it's functional with combinator style I don't see anything but the characters because there are so few I don't need to imagine anything.
Nothing.
The bastard in QA sitting in front of my “finished” program twirling his mustache.
Also, the meeting after launch where the client/users go to use the features I’m making. Their complaints. Their workflow issues. Performance bottlenecks.
I can visualize stuff just fine in general but I never visualize _anything_ when I'm programming, and I don't know what it would add if I did.
I don't see any charts or 2d stuff. I see 3d globs and cities.
Nothing. For complex algorithms, I prefer to think in invariants: "this condition should hold here, so this variable must be that".
I guess, for me the only exception is the dynamic programming algorithms. I re-discovered the wave algorithm (aka Dijkstra's algorithm) for solving mazes while writing in BASIC at school, and since then, I tend to reformulate any dynamic programming task as a path search in a maze.