Help! My Brain’s Turned to Spaghetti Code

Mom,

I’m a beginner at coding. I know my level of knowledge is okay, but I feel inconsistent about my level of skill. I could come at the same problem two different times, once instantly seeing the quickest, cleanest logic, and once twisting myself in knots with needlessly-complicated lines. Is it a state of mind thing? Does it get better with more knowledge, or more practice?

Thanks Code Mom!

Dear ‘Spaghetti Brain’, 

Take a deep breath, and let’s get your brain untangled. 

I can assure you that you’re not the first beginner to flounder in the valley between knowledge and skill.  Knowledge is theoretical–when you know something, you understand the why and how of it; you could give me a correct answer if I asked you a question.  Skill, however, is practical–it’s the ‘doing’ part, the ability to perform the activity.  It’s pretty common to be able to understand something “on paper” (or on screen, as the case may be!) before you’ve nailed down the ability to use it effectively.

When it comes to programming, knowledge and skill go hand-in-hand.  You need to understand the ‘why’ and ‘how’ of how to solve a problem, but you also need to be able to actually write the code!

How do you build skill?  With practice.  Heaping more facts onto your existing knowledge won’t matter a bit if you can’t translate that knowledge into code.  As you’ve found, it’s possible to sit down with the same problem and have a wildly different experience actually implementing the code to solve it… but the more you practice, the easier it gets.  Practice hones mental efficiency, and the less brain power you spend on the big parts of tasks (like solving the problem and writing enough code to solve it), the more you have for the smaller, trickier parts (like remembering syntax and writing clean code).  In other words: the way to get better at using for loops to solve problems is… well, to solve a lot of problems by writing for loops. 

I do want to touch on something you asked–”is it a state of mind thing”?  Sometimes, yes.  If you’ve been working at something for a while, or you’re having a rough day and falling into a negative mood, take a break!  It’s hard to focus and practice something when you’re frustrated, tired, hungry, etc.  Putting code aside for an hour or so to watch a TV show, talk to a friend, or have a snack may be exactly what you need to put yourself in a more productive mood. 

So, go ahead and practice those code skills!  You can start with a small side project, or by signing up for a kata site like CodeWars (https://www.codewars.com/), HackerRank (https://www.hackerrank.com/) or LeetCode (https://leetcode.com/). 

Hope this helps, 

Mom 


This question was asked by a CodeMom.net user via our “Ask Mom” form! Do you have a question for Code Mom? Use this form to ask your question, or ask Mom via social media!

Add a Comment