Two Mistakes to Avoid When Learning to Code
I've had the pleasure of tutoring 2 groups of beginner software developers at Sabio's coding bootcamp in Los Angeles and in Seattle. Here are two major points I've noticed that trips up beginner developers.
1. Glossing Over Syntax
When I was tutoring, I would find people were not understanding a line of code that I thought was simple. Things like assigning a variable, getting a value from an object or calling a function.
After questioning the students to understand why they were having trouble, I found out that the students just didn't know the syntax of the programming language. Of course no one knows the syntax or all the nuances of a programming language when you start, but at this point the syntax that was giving them trouble was at a lower level than the code they were trying to write.
What's great about programming we can easily try to build new things that we don't know how to do. For example, I can start making a iPhone App using the Swift programming language right now, without any knowledge of Swift. I can't do the same for making a restaurant. If you're making a career out of being a software developer, you should go back again and again and spend time on the fundamentals.
It is worth the time to really understand the syntax and other basics of how the language works and compiles. Programming is logic and to get to higher levels like designing software projects well you need to build on top of a solid foundation of logic.
To figure out if syntax and fundamentals are a sticking point to you, I would try to explain what your code is doing clearly and concisely to a non coder. Are you able to answer their questions and walk them through it? By the way, this is a good skill to have no matter what level you're at as a programmer.
When I started taking programming seriously, I went line by line, character by character to understand it. Sometimes it would take hours to go through one block of code. I took my time because I knew learning how to code well was going to take many years. Which brings me to the next point...
2. Not Putting in the Time
Learning anything takes focused time. When I was tutoring, I would have a class once a week. When I asked the students how much time they spent practicing during the past week, all too often people would say that they spent ZERO hours practicing.
At the start you want to spend the time building a good foundation and habits that will carry you through your whole career. When you start learning how to code, time spent learning should be your only metric of success.
Time is a good metric because you can easily measure how much time you're spending, and I suggest you track it. To me, it was motivating to see the hours piling up. If you're not putting in the time, ask yourself if this is something you really want to do. If it still is, restructure your schedule and create new habits to get back on track. If it's not something you want to do, move on to something else guilt free.
In number 1 above, I said that it took me hours to understand what one function was doing. I consider those hours as a deposit in my coding account that has given me compounded interest over the years. It also helped me build up the ability to sit down and focus on a coding problem for a long period of time. Sitting down and focusing on a task is a skill that you need to develop and it takes time.
If you want to be good at software development, the ability to focus on a single task for a period of time is the most fundamental of programming skills.
You can't teach code by osmosis, so time is the only metric that matters when you start. Try forming a habit of coding everyday for at least 1 hour. If I were to start from zero, I'd create a habit of waking up in the morning, setting a timer for 1 hour and code until the timer stopped.
Time should be the only metric of success when you start learning to code. Did you code for an hour today even though you may have struggled the whole way through and made no progress? If you did, that's a success.