Why Your Brain Hates Codebases

Photo by Kyler Nixon on Unsplash

The problem with software development is that it’s all in your head. There, I’ve said it. Building maintaining and debugging software is so darn tricky as:

  • You can’t remember everything

  • You can’t understand the interconnected relationships between modules easily

  • Your mental model is frequently faulty

The answer isn’t for you to perfectly absorb, recall and reason about every line of code. If we were able to do that, they’d be no bugs (and no meetings), so back in the real world, we need a better way to work.

So, let’s dig into what is going wrong, and what can be done about it.

The State of Play

I’ve had many bosses who claim that the codebase is a masterpiece of clarity. At the interview they sell you a “modern project” and when you get there…it isn’t.

In my current working environment, we have a really high turnover rate, and nobody really cares about tech debt other than labeling a ticket or two as such to please management. That has led to spaghetti logic that I simply can’t fathom, plus an if-then-else pyramid that runs to 200+ lines (which let me tell you is no joke).

Although nobody seems to care about the state of the codebase, they do care about the number of defects that software developers introduce into the code. It’s a problem at the core of software development.

It’s All in Your Head

In the sense that you have hard limits about how much you can remember at any time.

Working memory is limited and is said to max out at 7 elements (+- 2 elements). The magic number is 7, and you’ll need to use hacks to get better performance out of your mind.

I know one guy at work who writes everything down from their first day. A list of things they are told, and who to go to when they have potential problems. Ask them a question, and they’ll generally know the answer. I’ll come clean — that person is me. I know the limitations of being human and I work within them. I’d advise you to do the same, but since everyone hates documentation, I understand that you probably won’t do it — but you should.

Thinking Fast (and Slow)

When you begin to use your memory to its capacity you free it up for cognitive work.

When you’re under stress in a meeting you are likely to jump to a good conclusion, if your memory is in good order.

When you can’t think of something quickly enough you might induce stress. This isn’t a good feeling and can easily turn into a vicious cycle. There must be a better way!

Train Your Memory

Establish Routine

Put your keys in the same place. Have a logical space for all the important things in your life. Those folders on your machine? Use them. Save time. Feel happy. How hard can it be?

Aide-mémoire

Summarize and reduce those things you need to remember. Even the action of summarizing an important document will make it easier to recall that information.

Have something important to remember? Reduce it by tying a piece of string around your finger and only remove it when it is complete.

Brain Food

Eat foods that are good for your memory. Add green tea, blueberries, salmon, cabbage, broccoli, cauliflower, dark chocolate and turmeric to your daily intake.

Skip the junk food too, while you are at it. 

Get More Sleep

Your brain needs downtime to stay sharp. If you don’t get enough sleep, you’ll tax your memory and start forgetting things. Stay rested so you can keep your mind alert.

Have a Mental Workout

Zoning out scrolling social media is all fun, but challenging yourself will make you sharper.

Mental challenges like studying complex concepts make simple tasks like remembering names at a party seem like a piece of cake while giving you practice at the same skills that are required for both tasks.

Create Stories in Your Mind

As you introduce to new information, be aware of the surroundings and any possible details you can associate with the specific information. Recognize the order of events and then you can replay them in your mind to retrieve the answer and improve your memory.

Get Creative

Poems, songs and other mnemonics can be used to lock important facts in my memory. If you’re not creative get ChatGPT on the case to help you out, your brain will thank you.

Pay Attention

If you want to encode something important, focus on it. You’re more likely to encode it into your long-term memory if you use your full focus on it.

Exercise

Healthy body == healthy mind. Plus, you’ll live longer. How is that for a good deal?

The Solution: Tools

Here is a fictitious quotation:

A reporter interviewed Albert Einstein. At the end of the interview, the reporter asked if he could have Einstein’s phone number so he could call if he had further questions.

“Certainly” replied Einstein. He picked up the phone directory and looked up his phone number, then wrote it on a slip of paper and handed it to the reporter.

Dumbfounded, the reporter said, “You are considered to be the smartest man in the world and you can’t remember your own phone number?”

Einstein replied, “Why should I memorize something when I know where to find it?”

Which I guess someone might have misremembered (protip: they didn’t, it’s simply made up).

Yet it illustrates an important point. If you haven’t (yet) trained your memory, then augmentation is likely your best alternative. By that I mean when you have something important to remember use your phone and make a note of it. It’s not hard but will help you remember it and actually (for once) use the technology in your pocket for good.

How hard can it be?

Conclusion

Improving your memory will make you a better coder. You’ll remember more things about the codebase you are working on, and be able to process issues and problems in a faster way.

Who wouldn’t want that?

Previous
Previous

What’s Wrong With Musk!🤯

Next
Next

The Software Development Sniff Test🐶