Eddie
Posted on July 8, 2020
When I was in college, my Calculus professor gave me partial credit for a problem that I had solved correctly. He said that I took a few additional unnecessary steps to reach the answer. I was pissed. In my mind, I got the correct answer and he gave me partial credit because I didn't do it the way he wanted. But his point still stood. I could have done it a better way.
Programming is the same; there are multiple ways to solve a problem - some better than others. But unlike the exchange between me and my professor, us programmers can get multiple tries (most of the time).
Let's get into it.
Type every single character of your code
Impostor syndrome could be exacerbated from copy and pasting code snippets and examples and from using boilerplate app starters like create-react-app. As a beginner, you don't know what is going on under the hood and you might nonchalantly say you don't care, but deep down inside, you actually do - or at least if you want to become a good programmer, you should care.
One way to solve this is to practice typing every single character and line of your code. Much like athletes, chess players, and musicians do the same thing over and over again to get better, programmers, especially beginners, should practice repetitive writing.
Even if your code is partially copy and pasted from another source, practice typing that snippet by hand.
Work Backwards
Focus on the intended result. Focus on getting there first. It may be ugly. It may be slow. But that doesn't matter (yet).
Did your button work? Is that modal window displaying? Were you able to fetch the right data set from the API?
Yes, but there are some errors. Who cares? In this exact moment, who freakin' cares? You achieved the result. Now you can focus on making that error disappear, make sure your code is properly tabbed (or is it spaced?), etc.
How do I know if I'm writing bad code?
"In order to write good code, you must first write bad code."
I don't remember who said this, but the answer to knowing if your code is good or bad is: experience. Don't confuse programming best practices for good code. A programming best practice could simply be someone else's opinion, or it could be something that applies to general usage.
Here's a typical best practice for using the viewport meta tag:
<meta name="viewport" content="width=device-width, initial-scale=1">
But if you constantly rely on this as being the best practice, you don't expose yourself to understanding what other parameters and options there are to perhaps handle a situation that is unique to you. Use best practices as a starting point, but don't stop there.
Just start writing code.
It does not have to be perfect. Then ask yourself these simple questions to improve incrementally:
- Did I repeat myself too much?
- Does my code look messy?
- Am I being consistent?
If you have the resource available, ask another person to look it over.
Follow the carrot
The best part about programming is that feeling when you get a win. The cool thing is that these are typically visual and we as humans respond tremendously to visual cues. It's those incremental wins that keep us going.
There's more than one way to solve a problem
This is the key right here. You may have solved the problem, but you might have this looming thought or feeling that the path you took to get there is wrong or not the best way. You might feel self-conscious leading up to a code review. Guess what? That's normal and it's absolutely OK as long as you strive for continuous improvement.
And you know the best part? You can have another crack at it.
You can find me on the Twitter - https://twitter.com/eddieaich
Posted on July 8, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.