Why You Should Cross-Train Your Programming Brain
By: Amy M Haddad
It seemed counterintuitive.
Standing in Barnes & Noble one winter evening, I paged through a running book titled Run Less, Run Faster.
Supposedly I was going to become a faster runner by running three days per week, instead of the usual five or six, and cross-training two days. That meant on non-running days, I was going to do a different type of workout, like biking.
Any preconceived doubts were soon pushed aside.
The results were shocking: I got in the best running shape of my life and reduced my half-marathon race time by about twenty minutes by cross-training.
In retrospect, cross-training made sense: I was pushing my cardiovascular system in another way.
So when I began learning to program, I added cross-training to my programming regime. This time, I’d cross-train my brain to become a better programmer.
I encourage you to do the same.
The benefits of cross-training are well worth it.
A New Context
I kicked-off my cross-training practice with a formal logic course.
My aim was to get better at and and more comfortable with thinking logically in a context outside of programming. The time spent on truth tables, for example, got me thinking in terms logical operations, such as:
- true AND true = true
- true OR false = true
- true AND false = false
However, some of the biggest gains have come from cross-training in another subject: math.
Like the logic course, math provides another environment push my logical thinking skills. In the process, it’s improving my problem-solving skills.
Solving math problems exercises the skills we use each day as programmers: carefully thinking through the task at hand; troubleshooting errors, thinking creatively, and getting ourselves unstuck.
I’ve been cross-training with math problems for a while now, and there are two important benefits that come from it.
Problem-Solver Extraordinaire
The first is practice understanding the problem, which is key.
I’ve been guilty of starting a problem without fully understanding it; I’ve seen experienced programmers do the same.
The result is predictable: countless roadblocks, endless frustration, and very little progress.
Working through math problems provides another lens to get practice really understanding the problem, which is half of the battle.
Math problems, like programming ones, begin the same way for me.
I get a piece of paper and write the aim, given, and constraints. I dissect it: I pull out the important parts, disregard the rest, and see how they’re related.
At the same time, solving math problems provides practice homing in on the details—the right details at the right time.
This is a critical skill to learn.
Great problem-solvers have an uncanny ability to filter: they seem to instinctively know what details matter and what’s fluff. They also seem to know what matters right now.
This ability, of course, is sharpened with a lot of practice, which is why solving math problems is useful: it provides another environment to identify the important details of a problem.
Math problems require intense focus for me. I really need to concentrate on what I’m being asked to do. I check and double check that I’m working with the right details.
It’s not that programming problems don’t demand such effort. They do. But I’m less familiar with math problems than programming ones.
It’s like driving in your hometown compared to driving abroad; the latter makes you think a bit more.
That’s why solving math problems makes for a great cross-training workout: it’ll challenge you in new ways.
The Programmer’s Intuition
I recently began to learn JavaScript, and stumbled upon yet another cross-training technique: solving problems in a new language.
I apply the same problem-solving tactics and strategies that I use to solve Python problems in JavaScript.
Same process, new setting.
What surprised me about this cross-training technique were the many other benefits it offered.
Recycling Matters
First, you’ll see existing concepts from new perspectives, which can be recycled.
Here’s an example. I found myself using map(), filter(), and reduce() constantly in JavaScript.
That was interesting to me because I hardly used them in Python. I knew about them, but it was a rare day that I’d choose to use reduce() in Python.
I shocked myself this week when working on a Python problem, and I instinctively reached for reduce(). After several weeks of using it in JavaScript, I had a flash of insight to use it in Python.
I remember thinking to myself, “reduce() would be perfect here.” And it was.
Cross-training in another language can sharpen the tools in your programming toolbox. It can also prime your mind to notice opportunities to use them, and boosting your confidence along the way.
That’s what happened to me.
Cross-training in JavaScript got me comfortable and much more confident using map(), filter(), and reduce(), despite the language.
Indeed, what you learn and use in one context you can apply in another. And during the process you’ll develop your programmer’s intuition.
Embrace the Struggle
The other benefit of cross-training in another language is the struggle.
What’s easy in Python is harder in JavaScript, at least now because it’s new. Even the smallest of tasks can be tough.
Take sorting a list in ascending order. I sort lists relatively frequently in Python and don’t have to think too much about it. It’s comfortable. It’s familiar. I’ve done it lots of times.
However, the first time I sorted an array in ascending order in JavaScript I struggled.
I really had to home in on what I needed to do and how to go about it. I had to dig into the documentation on MDN. I had to experiment on a smaller problem and get that to work before I could solve the one at hand.
There’s immense value to this: it forces you to think differently and strategically. As a result, you sharpen your problem-solving skills.
Cross-training in this way has given me practice dealing with ambiguity, which is what we’re tasked to do each day as programmers.
Reap the Benefits
To reap the benefits of cross-training it pays to be consistent.
Just like you show up to program, show up and cross-train, even if it’s just a few hours per week. It’s a small investment for a big payoff.
In addition to the practical benefits, cross-training helps keep you enthused about your core activity.
I noticed that when running and with programming. The biking workouts gave my legs a break from the toll running took on my knees. After a day of biking I was ready to get back to running.
Likewise, the math and JavaScript training help keep programming fresh and interesting. It’s a matter of getting practice in a new environment—and pushing your logical thinking in another way.
Above all, cross-training gets you out of your comfort zone, which is where the real learning and growth happen.
← back to all posts