3

5 Things to Do When You Get Stuck Learning to Code

 1 year ago
source link: https://www.makeuseof.com/code-learning-stuck-things-to-do/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

5 Things to Do When You Get Stuck Learning to Code

Published 5 hours ago

Have you hit a programming brick wall? With these ideas, you'll be back making progress in no time.

Lady with hands wrapped around her head in frustration

Learning to code can be boring when the going gets tough, especially if you get stuck on a particular coding task. But you're not alone; even experienced programmers will admit to struggling over a few lines of code sometimes.

Do you often feel stuck while coding? Try out the following ways of getting over your coding problems.

1. Use the Problem-Chunking Method

Blocks of code in a code editor

It's often best to chunk coding problems into smaller units, especially if what you want to achieve seems complicated.

For instance, say, you want to add an authentication system to your Node.js app. One of the best approaches to this is to draw a flowchart detailing all you need to achieve it, including your custom logic. This helps you focus on a unit at a time without worrying much about the bulk.

You might break it into the following stages:

  • Check if the user in the request body is in the database.
  • Compare the password in the request body with the one in the database.
  • Create an authentication token storage strategy; decide if you want to use cookies, session, or local storage.
  • Pass authentication token into login request.
  • Authenticate the user.

This is only an example and not a blueprint for developing a login system. Yours can come in another dimension. However, writing isolated pseudocode for each step also helps you focus on one task at a time. You can then implement each chunk of pseudocode to use in your real project.

2. Use Stack Overflow and Other Q/A Sites

Question marks in bubbles with skeletal brain

You'll often come across Stack Overflow while searching for answers to coding questions online. It's a platform you can't ignore if you want to solve coding challenges quickly. Although it's rare not to find answers to your coding problems on Stack Overflow, you can register and ask your question if that's the case.

Nonetheless, Stack Overflow has some unfriendly policies that can put new programmers off. Question and answer (Q/A) sites like GitHub Community, Code Project, W3schools, and even Quora, are popular alternatives.

Use the search bar on these platforms to query answers to your specific coding problem. No matter what your question is, or which language you’re using, there's a good chance someone else has asked a similar question before.

Regardless of the platform you use, pay attention to your approach to problem-solving while searching for answers. One of the best ways to solve your coding problem this way is to read and comprehend the concept behind similar code that you find online. Try not to hook the code into your project without understanding its fundamental logic. You should be able to explain it to someone in plain terms and even tweak it to work as you want.

3. Learn to Google-Search Answers

Google search bar on a laptop screen

Many developers tend to shy away from admitting that they search Google for answers, but they do so daily. And to say it's an essential skill every programmer must possess is nothing but the truth. This entails getting solutions from Q/A websites and blogs.

There's nothing special about Google searching for coding solutions, but knowing what to search for is the challenge. For instance, you might get confused if you search for something like "how to use a database" when, in fact, there are many databases. Although Google might bring answers to your query, finding relevant ones will be difficult.

Therefore, specific queries are better ways to use Google search effectively. For instance, you can search for "how to query a MongoDB database in Go" instead of the more generalized one.

4. Connect With Other Developers

A group of people discussing on a table

Isolation can be a motivation killer. Besides asking questions online, collaborating with other developers around your location helps. Meet with other programmers around you and engage in code reviews.

Also, sending an email to other programmers to help you with your coding task is another way to solve your problem. Following a programming tutor on YouTube? Don't hesitate to reach out to them for help! You might learn more than you could imagine from doing so.

5. Learn to Debug Your Code

Laptop on a table with programming tips on cards

Debugging is a skill in programming that requires tenacity and patience, and it goes a long way to solve your coding problems if you use it. There's no strict routine for debugging code since every programming language has its syntax. However, there are some language-specific principles that you can follow to get a grip on debugging.

For instance, you can debug JavaScript via the browser console. Using the node command to run JavaScript via the command line is also an excellent debugging strategy. All you need is to install Node.js on your machine. You can then run the script in the command line like so:

node script.js

Rubber duck debugging is an alternative involving talking about your bugs to friends or colleagues. It might help you get out of the vicious cycle earlier than you thought. And there are also some pretty helpful ways to debug your Python code if it's your language of choice.

Coding Challenges? Know When to Take a Break

There are various ways to solve programming problems. But coding profusely without a break can result in coder's block. One of the best approaches to solving programming problems is to walk away from your code, especially when you start getting mixed up. Sleep on it or take a nap if you have to; this helps refresh your memory and gives you new energy for a fresh start. You'll be surprised how it all goes when you return after the break.

About The Author
62810a849db32-61781fdab6402-Screenshot_20210922-164458.jpg?fit=crop&w=100&h=100

Idowu Omisola (148 Articles Published)

Idowu is passionate about anything smart tech and productivity. In his free time, he plays around with coding and switches to the chessboard when he's bored, but he also loves breaking away from routine once in a while. His passion for showing people the way around modern tech motivates him to write more.

More From Idowu Omisola

Subscribe to our newsletter

Join our newsletter for tech tips, reviews, free ebooks, and exclusive deals!

Click here to subscribe

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK