code

How to Not Suck at Coding - Part 1

Yashu Mittal

Coding is damn hard.

When you’re just starting out, coding is hard as hell.

There’s just a lot of stuff to learn in web development. Front-end or back-end? React, Angular, Ruby, .NET? AJAX, JSON, SQL, MySQL, noSQL??

You may feel at times that you’re drowning in technobabble.

11S00bVViOB6a4.gif

The good news is, you can get good at coding. The bad news is, you are not going to master it in 12 weeks. Sorry if you’ve been told otherwise. Now, you can certainly pick up some of the basics in that time. But it will take years of practice and hard work before you become an expert.

So, how do you maximize your learning?

The strategies listed here cover both areas. These are tricks that I’ve picked up since I started out my own coding career, seven years ago. And believe me, frustration was my closest friend during those first couple of years.

My hope is that I can make your journey up that steep learning curve a little less painful and a little more fun.

Let’s go!

Learning and Remembering

Don’t Learn the Same Thing Twice

When you learn something in coding, you want to be as efficient as possible. If you can grasp a concept with a minimum of time and effort, you’ll progress more quickly.

As a basic example, let’s say you want to center some text on a website. You start out, like all good web developers, by punching a “how to” search into Google.

That leads you to a StackOverflow post, where you discover that you can center text by adding a CSS style, text-align: center. Nice! Copy that, paste it into your file, reload the page and you’re gold, all in under 5 minutes!

That was easy.

Now, let’s say the next week you have to center some more text, and you don’t quite remember how you did it the last time. So it’s back to Google, and after copying and pasting again, you’re done. Still easy, right? Sure.

The problem is, you repeated the exact action you did last time. That’s inefficient. It’s one of the main principles of good coding, actually: don’t write something twice if you could just write it once.

Your problems will take more time to solve as you get to more complicated concepts. I’ve spent hours trying to figure out how to get something to work. And the second time that that exact problem comes up again? If I have to completely start over to research and test all over again… that. is. torturous.

If only I remembered how I did it the first time!

If you could remember how to solve a programming issue after the first time, imagine how much time you would save! It would be minutes or hours for every subsequent time you had to use that bit of code. The problem here, of course, is that it’s quite difficult to perfectly remember something after only seeing it once.

What you need is a memory proxy. A way to quickly remind yourself of the solution the next time it comes up.

You need to write down that solution in a place where you’ll be able to go back and reference it. It doesn’t have to be in a 3-ring binder like in middle school. It could be in a Word doc, a Google doc, or even a paper notebook.

xkmQfH1TB0dLW.gif

Understand the Why

In addition to keeping good notes, you have to understand why some piece of code works. Otherwise, you’ll be learning the same concept over and over again, and your notebook will just be a magic spellbook that you can’t live without.

Don’t just copy and paste mechanically. Engage your brain!

When you’re looking through code snippets on StackOverflow or GitHub, really look at the code.

Try to understand how that small bit of functionality does what it does, and how it fits into the greater picture of web development.

Going back to the text centering example, once you see the text-align attribute, you might be curious what that’s all about. If you do some further research, you’ll see that you can not only set the text to center, but you can align it to the left, right, and even justify it.

Aha! You’ve now gotten to a better understanding of aligning text on websites.

Some people recommend never copying and pasting, and just manually typing out any code solutions. This is a good method that forces you to think and remember the syntax of the code.

The key here is to look beyond finding a short-term solution for your current problem. Your long-term goal isn’t just to fix this one bug, but to add it to your knowledge bank.

Learn Coding By Doing

One slight pitfall in this method of learning is that it’s completely reliant on whatever problems just happen to come up. And if you don’t encounter that same issue for several weeks or months, it will quickly fade from your memory.

In order for a new idea to really stick, you have to be exposed to it multiple times. This is the principle of spaced repetition systems, often used in language learning.

The idea is that you learn one thing, and then right when it’s about to drop from your short-term memory, you re-test yourself to retrieve the memory. Over time, that concept will eventually make its way to your long-term memory.

Learning coding is a bit different from picking up new vocabulary words, but you can still make yourself go back to a specific concept and practice it again.

Here’s an example:

If you’re trying to figure out how to embed a custom Google map into your site, you could follow these steps:

  1. Do research on custom Google maps, test, and get the solution to work.
  2. Take good notes, with step by step instructions and links to references you used.
  3. Then a few days later, try to make another custom Google map without looking at your previous code.
  4. If you don’t remember something, refer back to your notes.
  5. Keep track of where the gaps in your memory are, and spend more time trying to understand the concepts behind them.
  6. Repeat these steps until you feel pretty confident that you understand how to make the map from scratch.

It can get a bit tedious redoing work, especially when there are a million other cool things you could be building. You don’t have to do this with every single new coding fact.

But for those concepts that seem to be important, it might be worth it. Spending extra time on it now will save you time later down the line. Especially if you think that you will encounter the same problem again in the near future.

Taking notes, understanding core concepts, and practicing coding are all things that have helped me in my own coding journey. I do want to emphasize that you need to think in the long term when it comes to learning how to code.

You can learn a lot from a good coding bootcamp or from online courses. But it’ll take time before all the concepts form a larger coherent image in your brain of how web development works.

Try to be patient. It’s like learning a language by living overseas. The more you immerse yourself and surround yourself in it, the more it will start to make sense. You’ll start making connections, and one day you’ll look back and realize that you just get it, in a way that you didn’t before.

3o7btNhMBytxAM6YBa.gif

This is the first installment of a two-part series about how to not suck at coding. The next part addresses problem-solving techniques.

Response to “How to Not Suck at Coding - Part 1”

Stay current

Sign up for our newsletter, and we'll send you news and tutorials on business, growth, web design, coding and more!