DEV Community

Cover image for Avoid COGNITIVE OVERLOAD when programming in 4 simple ways
Douglas Parsons
Douglas Parsons

Posted on • Originally published at on

Avoid COGNITIVE OVERLOAD when programming in 4 simple ways

Programming can be an arduous activity. You have to remember what you are doing. Remember the context and inner workings of an application or system. Remember the syntax and building blocks of the language you are working in. Remember locations of code to come back to and tweak later. Remember what steps you have to take to achieve a goal. And you often have to do all this while learning a new codebase, technology, language and domain.

All these things you have to remember fight for space inside your brain. You can feel lost, overwhelmed, or feel like your brain has turned to mush. Your brain has too much to remember, and too much to process all at once. As a result, it starts to drop the ball. Making decisions becomes a difficult task as you overthink, over-analyze and over-complicate everything. You forget what you should be doing and forget what you should be doing later. This is COGNITIVE OVERLOAD.

Our brains aren't designed to store and process all this information all the time. Luckily, there are four simple steps you can take to reduce the amount of strain on your brain.

1. ✍️ Write Everything Down #


The first thing I want to talk about is 'Getting Things Done'. This is a productivity methodology introduced by David Allen. His book tackles a common problem: often we have many different things in our lives to track and organise. These commitments can range from work, friends, hobbies or family. Our commitments are usually only stored within our head and as a result, are badly managed.

The most important idea is to realise that our brains are not a good place for storing information. Instead, we should be using our brains as a source of ideas. A place for creative thinking.

The best way to do this is by removing anything our brains need to remember.

The solution is super simple: write everything down. We can write down how an application works. We can write down the basic syntax rules for a programming language. We can write down a to-do list of all the things we need to remember.

Every single piece of information written down is one less thing to think about. One less thing our brains have to keep. This reduces the cognitive load by simply removing information we can keep elsewhere.

2. 🔖 Bookmark Locations To Come Back To #


Have you ever gone to make a specific change when programming and recognised a piece of tech debt or a bug lurking? And then, by the time you've jumped down a rabbit hole of fixing things up you've forgotten why you were even there in the first place?

Every single distraction we get when programming is one more thing to remember later. Yet, fixing bugs, improving code quality and cleaning up tech debt are all important.

Again, the solution here is simple: every time we want to diverge from the task we started on, we need to make a note. Attempting to remember does not work as this just adds to the cognitive load. Even more so because you can get distracted from a distraction. You can fix tech debt and get distracted by a bug. Or when you fix one problem, realise that there's another you didn't initially spot.

I like to think of this as a stack of plates we are balancing, all of different sizes and shapes. Trying to keep one balanced isn't a problem. Getting diverted adds another plate to the top of the pile though. As we get diverted more and more the stack of plates becomes heavy, difficult to balance, and increasingly precarious. If instead, we were to put each plate down as we picked up a new one (by writing it down), we can just keep a single plate balanced. The cognitive load here drops. We can instead use our brain to focus on the task at hand, rather than on balancing plates.

3. 🕑 Spend Time Away #

Time Away

It's a widely held theory that sleep serves a clear purpose: it helps our brains decongest. Sleep helps store important memories and things you've learned. It gets rid of unimportant memories. It allows our brains to sort through complicated thoughts and feelings.

Our brains are complicated devices. It's rarely clear how they work or what they are doing, and they are not well understood.

But, this idea that sleep helps decongest our brains gives a powerful insight. Our brains are capable of doing background processing. We don't have to actively think on a problem for our brains to digest it. Did you ever wonder why people have some of their best ideas in the shower, or when they are out for a run? This explains why.

Furthermore, it's important we tap into this background processing the brain can offer. Why bother banging your head against a wall over and over, when taking a break can allow our brain to figure things out?

4. 🗣️ Talk To People #

Have you ever heard of rubber duck debugging? The idea comes from a book written by Hunt and Thomas. The idea is that a programmer would explain his or her code, often line-by-line to a rubber duck. In forcing his/herself into the perspective of a teacher and explaining what the code should do, and actually does, problems are often spotted.

Rubber Duck

The idea used a rubber duck as this is an 'inanimate object', and prevents disrupting anyone else. However, this neglects all the benefits that talking to another person can provide. They can:

  • ask questions that make you consider your approach
  • provide suggestions on how you can tackle a problem
  • suggest alternative solutions
  • provide a wider range of perspectives on the matter
  • often, provide more expertise on a subject area
  • provide a more intricate knowledge of existing solutions

And, even more than this, the ability to share knowledge with a teammate is a valuable skill. By having two people understand a problem the brainpower used to solve a problem doubles. This can lead to better solutions (it's no wonder pair programming exists). Sharing, really is caring.

✅ To Conclude #

Programming is a complicated task. Programmers often have to hold many things in their memory. And yet, they are expected to simultaneously come up with creative solutions to complicated problems. This leads to a huge amount of cognitive load.

The solution is simple though. We need to remove as much of this load as possible, allowing the brain to focus on the tasks at hand. We can achieve this in 4 simple ways:

  • By writing down everything we learn.
  • By bookmarking anything that we need to come back to.
  • By allowing our brains to unclog by spending time away.
  • By changing perspective and sharing with others.

Do you think there is anything I have missed? Do you use any of these methods? Please comment, or let me know.

Thanks for reading. If you enjoyed this article, please share or follow me on twitter.

Top comments (4)

amehmeto profile image

You forgot the more important: be disciplined, even zealous with Clean Code. You should be able to read code like well written prose.
Use and abuse of the "extract till you drop" technique.

dglsparsons profile image
Douglas Parsons

That's another great point! I didn't think about the quality of code. Thanks for pointing this out :)

elizabethmorrison56 profile image

Very useful tips, thank you for sharing!

dglsparsons profile image
Douglas Parsons

Thank you - glad you like them :)