Follow

Occasionally while programming, I will hit a point where I'm thinking slowly, coding slowly, and generally everything is going slowly. I typically can't really solve programming problems in this state. But I've found that when this happens, if I start programming auxiliary functions, general purpose tools, generic definitions, etc things unrelated to the cause of the immediate slowdown, that it helps to break the slowdown and keep momentum up

eg: Let's say you have a library of shapes and you are programming a function to check the intersection of two shapes, but you are having trouble keeping momentum up, and things are slowing down. Instead of doing the thing where you sit there with programmer's writers blocks trying to mentally reconstruct the same old problem-structure in your mind as its actively falling apart, you can start programming other things related to shapes: a method to calculate the volume / area; a function to translate, rotate, and scales shapes in space; variables for unit version of each shape; etc. And this might help alleviate the slowdown. Incidentally, if it doesn't help you start working on your problem again, you've just programmed a bunch of stuff that is potentially useful later

Incidentally, this looks a lot like the switchover from top-down design to bottom-up design: where you go from solving your problem by composing things you have, to making new things you can compose together and solve problems later

It feels like slowdowns like this are frequently the result of some sort of mental saturation, where part of your brain is worn down from tackling this one problem for so long, that it effectively can't handle it anymore. Like, if you imagine you're building something irl: you start with a (hopefully) very clean workspace, but as you work stuff accumulates, and under certain conditions the accumulation can begin to slow down or outright stop new work in the workspace. But you clean your workspace up to make it ready for new work. Based on my own experience, I imagine human brains behave analogously: as you work on a problem your brain becomes saturated with mental cruft until its ability to work on the problem is slowed or stopped

@jmacc I find that happens when I don’t have a good mental sketch of the problem. It’s my cue to stop hacking and plan some more. Going bottom up also helps as you’ve seen.

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.