Learning to code can be maddening.  A simple typo can first have you pulling out your hair, then questioning your career choices and eventually it might leave you questioning your own sanity.

Learning to conquer this frustration and persist through troublesome errors is part of learning how to code. If you can’t learn ways to constructively cope with the stress of troubleshooting, you will never be successful in web development or design.

So here are 10 tips for learning how to write code and keep all your hair.

1. Remember you are building brain pathways — Be Patient.

Be patient with yourself.  Learning to code is literally learning a new language, it took 3 to 5 years for you get a decent grasp on your first language and coding is like nothing else you have learned before.  It takes time and it can’t be forced. Seriously, you can’t cram things into your mind that your mind doesn’t have placeholders for yet. It takes repetition and practice for those connects and placeholders to be formed.

Have you ever worn a path through any vegetation in the woods or maybe in a yard?  The first time through is tough going and slow because of all the undergrowth in the way, so you clear some branches on your way and the second time through is a little bit easier, but still hard.  Eventually after walking the path over and over it will be clear and easy going. Learning to program is the same. It takes time for your brain to clear out the brush and create paths, but if you keep at it, eventually it will get easier and you will get it.1

2. Focus on the foundations — Don’t get distracted.

Don’t get distracted by the shiny advanced stuff yet. If you have ever played basketball, you know that you have to learn how to dribble before you can practice a layup. For a musical instrument, you have to learn the scales before you can play a real song.  You can’t scale Mt. Everest the day after you take up mountain climbing.

Understand and memorize the basic commands, syntax, and logic for whatever language you are learning.  When that starts to become second nature, then you are ready for the more advanced aspects of a language.  Trying to go too fast will only frustrate you, kill your morale, and make you less ready to learn.

3. Avoid the abstract and keep things practical — Learn by doing.

Learn by doing. Tutorials that actually teach you how to make something will be more valuable than courses that just show you how a language works without any context.  This also means that you have to follow along and do the work, step-by-step with the tutorial. 

Trying to understand new concepts without a practical concept is like trying to hang your hat on the wall without a hook.  Like a hat needs a hook, coding concepts need a context.

Don’t just watch a video or read a book. Working through the problems in a tutorial along with the instructor is one of the best ways to wear down that path in your mind, plus you get the satisfaction of actually accomplishing something concrete in the end.

4. Brains get tired too — Take a break

Just like a muscle, your mind gets fatigued under strain.  And just like when your muscles get too fatigued you are more likely to injure yourself, you are more likely to make mistakes when your brain gets too tired too.  So be aware of your mental state and at least once every hour take a few minutes to give your brain time to relax.

Reward your brain for all it’s hard work by doing some of these next few things…

5. Stretch and get your blood moving again.

Part of taking a break should include getting up and stretching, walk some, do some yoga, back stretches, situps, pushups, jumping jacks, anything to work your muscles and get your blood flowing.  This will let your brain relax with mindless body movement and get your blood pumping again which will feed your brain with much needed oxygen.

6. Your brain gets hungry — Feed it.

Feed your brain some calories.  Did you know your brain accounts for around 20% of the calories your body burns, even more when it is working hard, although don’t plan on losing weight by thinking hard2.  So reward it with a little boost of calories. Carbs are excellent brain food, but avoid sugar because it will just make you crash later on.

It doesn’t take a lot, so don’t feel like you need to eat a big bag of chips.  Healthy food is always better because it will give you more staying power. I like roasted almonds or a regular size bowl of popcorn to help perk me up, in fact, I’m eating some right now.

7. Eliminate distractions — Turn off YouTube

Eliminate distractions, turn off the TV or YouTube (unless that is what you are learning from).  You may think you can watch a show while you learn but you are really getting the worst of both worlds, you aren’t enjoying the show as much as you should and you aren’t learning half of what you could be learning.  Really you are just short changing yourself.

8. Multitasking is making you stupid — Single-task like a pro!

You know what sets apart someone that is amazing at something from someone that is just good at something? Focus! Single minded focus on the task at hand. In this case, your task is learning how to code. Close all your other tabs, mute your phone, shut-off your email and social networking notifications while you are learning.  Multi-tasking is for mediocre work.

One hour of completely focused single-tasking is worth 10 hours of learning with constant distractions.

9. Give yourself a focus boost — Drink some caffeine

The science behind this is still up for debate4 and I give this advice with several caveats. First, I don’t drink caffeine after 5pm because it will make it harder for me to fall asleep that night.  Others say they can fall asleep fine, but the sleep isn’t as good.

Caffeine takes 30 minutes to fully hit your system and has a 6 hour half-life.  That means that from your last drink it will take 6 hours before it has degraded to half its original potency.

My other caveat is, again, to avoid sugary drinks.  A sugar crash will counterbalance any of the good effects from the caffeine. Having hedged my advice, caffeine is a wonder drug that is safe, if used responsibly, and can help you stay alert and focused.  Like anything, moderation is key.

10. Distract yourself from distractions — Listen to music

Find a good music mix to listen to.  Music helps drown out all the other distractions around us.  Avoid music that you will want to sing along with.  I prefer repetitive and melodic music that seems to encourage creative but structured thinking while helping to shut out distractions.  Any Radiohead fits the bill for me, but Ok Computer is my current favorite. Obviously this will depend on your own music preferences.  Classical music is perfect for helping your brain focus without being a distraction.

I use some if not all of these healthy coping techniques for troubleshooting code nearly every day to maintain my own sanity, I’m sure they can help you too.  But wait, there is one more thing.

Bonus: Silver Bullet for killing frustration!

I have one more silver-bullet, sure-fire method to help you get through a troubleshooting nightmare. Sign-up here to get my simple, sure fire guide for dealing with coding frustration.

 

 

Featured Image from Tim Gouw

Reference Notes:

  1. PLASTICITY IN NEURAL NETWORKS
  2. Brain Power: Q. Does extra mental effort burn more calories?
  3. Why Single-Tasking Makes You Smarter
  4. Caffeine and a healthy diet may boost memory, thinking skills; alcohol’s effect uncertain
%d bloggers like this: