Do you have poor short-term memory? 🧠
Tags: shorttermmemory, memory, softwareengineering
Published: 2022-12-28 13:02:16

Hey developers!

Do you have poor short-term memory?

Struggling to juggle countless bits of information you need while coding?

We covered this once, but due to the popular demand, here is a spin on it.

<h3>Problem-solving with short-term memory</h3>
Short-term memory, also known as working memory, is an essential cognitive <a href="https://helloacm.com/teaching-kids-programming-algorithm-to-truncate-sentence-via-split-function/" rel="noopener" target="_blank">function</a> that allows us to process and retain information for a limited time. This type of memory is critical for performing tasks such as solving problems, making decisions, and learning new information.

For software developers, short-term memory is particularly important. You must be able to juggle multiple bits of information simultaneously when solving problems. Visualizing the design, data flow, algorithms and data structures is an essential skill in developing. 

A strong short-term memory can also help developers learn complicated concepts faster, interact with colleagues more effectively, and collaborate on projects more efficiently. But what if you have a spaghetti strainer memory?

<h4>Tricks and tips</h4>
You have probably found yourself in a situation where you're debugging the code and feel like you’re solving a jigsaw puzzle – only you're keeping all the pieces in your head and trying to form a complete picture. If you forget a part of the puzzle while doing that, it is almost guaranteed the solution will elude you.

It doesn’t help that short-term <a href="https://helloacm.com/bash-function-to-get-memory-information-via-awk/" rel="noopener" target="_blank">memory</a> can be worsened by factors such as stress and sleep deprivation, which most developers are familiar with. 

As a result, it is highly important for developers to regularly engage in activities that can help to improve and maintain their short-term memory.

Some examples of activities that can benefit short-term memory include:

<ul>
<li>Practising mindfulness and meditation</li>
<li>Exercising regularly</li>
<li>Eating a healthy diet</li>
<li>Getting enough sleep</li>
<li>Engaging in brain training exercises, such as puzzles and memory games</li>
</ul>

Undoubtedly, it would benefit you to do all or any of these activities. However, if you’re looking for a way to deal with the memory issue as a developer, perhaps you should also consider changing how you write programs. 

<h4>Literate programming</h4>
If you have short-term memory, it might help you to write the comment before writing the <a href="https://codingforspeed.com/finding-that-perfect-code/" title="Finding That Perfect Code">code</a> and then use it to remind yourself about all the details as you go through the implementation. 

Literate programming, introduced in 1984 by Donald Knuth, is a methodology that combines a <a href="https://codingforspeed.com/is-there-such-thing-as-high-quality-code/" title="Is There Such Thing as High-Quality Code?">programming language</a> with a documentation language. It is a move away from writing programs in the manner and order imposed by the computer. Instead, you develop programs following your logic and thought process, using a natural language. 

The main idea behind literate programming is to treat a program as a piece of literature and make it easily maintained and robust. 

Many developers like to document code extensively, adamant that it helps them with their short-term memory, while some still believe comments go out of date quickly. 

What's your opinion on the matter? Hit reply and share your thoughts with us.

Would writing the comment first help your short-term memory?

Reposted to [Blog](https://codingforspeed.com/do-you-have-poor-short-term-memory/)