Many false starts are due in part to the slow and tedious process of learning to code and the frustration that accompanies it. Consequently, I’m passionate about removing the unnecessary obstacles that prevent people from becoming competent coders. There will always be obstacles, but there’s no reason for unnecessary obstacles. 😁
Here are 10 tips to help you more quickly leap over the hurdles and achieve a sense of competency. Many of these tips might seem minor or obvious to you if you’ve been coding for years, but when starting out, nothing is obvious. And even if you’ve been coding since cell phones were called car phones, there might be a tip or two that will save you time.
- Split your screen. Most of the time when you are learning to code, I suggest you split your screen(s) into two side by side panels — one for the code you’re working on in your Jupyter notebook or code editor and one for your web browser. You’ll use your web browser to look at documentation, Stack Overflow, and tutorials. If your screen is too small, I suggest you get a bigger one — if you can afford it. You can get a 25-inch monitor on Amazon for a little over $100 in the US. As you get more proficient, you’ll often want to focus on a single piece of work. Use can use keyboard shortcut keys to toggle between split screen to full screen. For a Mac, I like the BetterSnapTool for $2.99, some Windows options are discussed in this article. 🖥
- Cut out distractions. Silence notifications on your computer and phone. Move your phone away from you if you can. Play some calming instrumental music or use noise-canceling headphones if you’re in a noisy area. The better you can focus, the faster you can learn. 🎻
- Type out example code. You can’t just read a tutorial and hope to remember it. Copying and pasting is of little value. You have to type it. Then extend it. Then type it from memory. “In theory, there’s no difference between theory and practice. In practice, there is.” — Benjamin Brewster originally — not Yogi Berra. ⚾️
- Learn over multiple days. Learn a new code concept and quiz yourself on it over multiple days. Research shows that when it comes to remembering things for the long haul, spaced repetition works far better than cramming. 🚚
- Learn by teaching. Clearly explaining a concept to others — either out loud or in writing — forces you to understand the concept’s essence, draw relationships, and create analogies. You strengthen the connections in your brain. This tip is part of the excellent Feynman learning technique. 📚
- Language before the library. Understand a programming language well before you try to use a library written it. Variable types aren’t the most exciting topic. Classes with attributes and methods might seem advanced. But once you understand a language really well, the library is far easier to use. You’ll make a few errors and save so much time.
- Learn one thing at a time. Don’t try to learn two things at once. You don’t learn twice as slowly, you learn like 10x as slowly. 😉 Relatedly, don’t get distracted by shiny things. Have a place to keep URLs that look like tempting rabbit holes to jump down. Put the URLs that aren’t relevant for the thing you’re learning right now somewhere for safekeeping. One Tab is a handy Chrome extension to use to save tabs for later.
- Sleep, exercise, and stay resilient. 😴🏃🏾♀️Put your brain in a strong position to form and strengthen neural connections. 🧠 Learn more about techniques to help you stay sharp in my Memorable Python book.
- Learn to type code faster. ⌨️ The more you type unusual symbols, the faster you become at typing them. However, a little intentionality can speed this process significantly. Invest in learning a good touch typing form. Here’s a little exercise to help from SpeedCoder.
- Become a pro with keyboard shortcuts. Here are links to shortcuts for Chrome, Mac, and Windows. If you’re a data scientist or data analyst, I made a GitHub Gist of Jupyter Lab shortcuts here. It’s also a good idea to create shortcuts for a Mac or Linux terminal by adding lines such as the following to your Bash Profile at
alias gs="git status". Then restart your terminal and type two keystrokes instead of two words. 😉
Bonus: Learn to Solve Errors Quickly
This is such a big topic that doesn’t get enough attention that I was debating writing a whole article on it. Instead, here’s a bonus section — a 5-step plan to resolve errors faster.
Every programmer see lots of errors. Once you’re experienced, most don’t cause more than a shrug, because you can resolve them in under a minute.
However, when you are starting out, an error might take 20 times longer to resolve. To a beginner, errors can make you feel like you’re trudging through ankle-deep mud.
Here’s a game plan for resolving 95% of errors quickly.
So you’ve got an error, what should you do?
- Look for a typo — a parentheses that are missing or a variable or function that’s misspelled. Syntax highlighting can help here. Always do your typing in software that provides code highlighting to improving your chances of avoiding or quickly fixing indentation, unbalanced parentheses, and similar errors. There are lots of good code editors to choose from. If you are just starting out, I suggest VSCode — it has the most market share, it’s free, and it has gobs of handy features.
- Read the top and bottom of the error message stack trace first. The code in the middle is generally less helpful. Then look at your code and see if you can figure out what’s wrong, given the clues in the error message. If you can’t decode the error message quickly, copy and paste the last line of the message into Google (if using Python. Other languages might have the error message before the stack trace). New coders biggest mistake is not turning to google with an error message quickly enough.
3. Filter the online resources to separate the wheat from the chaff. 🌾 Here area few heuristics to help you find higher quality resources faster.
Stack Overflow, Medium, Reddit, Hacker News, Dev and other online communities have feedback indicators such as upvotes or claps to show which content is on target. These metrics aren’t perfect, but they generally work pretty well. Stack Overflow, the Towards Data Science Medium publication, GitHub issues for the repo in question, the official docs for a language or library are the sites where I find the most solutions.
It’s hit or miss with the quality of blogs in Google search results. If you’re using Python, I can suggest some good sites based on my experience:
4. Avoid older resources. For most problems, you want resources that aren’t more than a few years old. When searching for a solution to an error on Google, filter out old results — either by time-boxing the search parameters or informally when looking over the resulting snippets.
If you’re starting out in Python, content about Python 2 from 2009 is unlikely to help you. 🐍
APIs evolve and how things were done is often not the recommended way to do them today. You are more likely to find an applicable answer in relatively recent results. 📆
If your initial forays are unsuccessful, then it’s worth looking through older posts and lower-quality sites on the next pass.
If you use the Python pandas library for data manipulation, there are common errors. Here’s a GitHub Gist I made with a Jupyter notebook of common errors and how to resolve them:
It would be great if Python and pandas provided really helpful error messages that included explanations of the likely cause of the errors. That sounds like a valuable project if anyone wants to tackle it! 👍
That concludes my plan for dealing with errors more quickly. Please let me know if you have other suggestions.
Hopefully, these 10 tips for reducing frustration and increasing your speed will save you time. And hopefully, the 5-step plan for resolving error messages will help you or someone you learn more faster. 🚀
With the right mindset, a little guidance, and a lot of practice anyone can learn to code. It might not be fast or easy, but hopefully, this article will make it a bit less frustrating.
Happy Learning! 🚀
If you’re interested in tips to help you increase your productivity, subscribe to the author’s monthly Data Awesome newsletter.
Original post here.