Introduction
image from unsplash.com by Nubelson Fernandes
Did you know it's normal to get stuck as a developer?, even experienced developers do too. Writing code or programs is one thing, errors arising is another.
From a simple omission of one character or even misspelling of words, your code will indicate an error. This goes to show that errors can stem from the tiniest bit of mistake.
So what should you do when you get stuck? in this article we will cover:
- Types of errors
- Debugging and steps to debugging
- Helpful online communities to check out
- Tips to try when you get stuck
By the end of this article you should be able to:
- Identify errors
- explain and execute debugging
Let's get into it
Identifying errors
Error prompts are ways in which an integrated development environment (IDE) can display errors. The types of errors that can occur include:
Logic errors: In this type of error, your code or program will run but displays a wrong/unexpected output.
Syntax errors: This error occurs when your code doesn't follow the correct syntax or sequence of the programming language.
Runtime error: As the name implies, this error occurs during execution or running of your code/program.
Read more about errors here.
What is debugging?
In simple terms it means getting rid of errors/bugs in a code/program. It involves identifying and fixing the error/bug. Usually IDEs e.g. VScode, come equipped with tools for debugging.
Steps to debugging
Identify the error : Logically this should be the first thing to do - you can't solve a problem you can't find. There are several ways of identifying the error including:
- Using the error prompt provided
- Using the console log by pulling up developer tools on the browser
Locate the error : After identifying the error you can locate it's position. The location of the error is usually stated on the error prompt.
Devise a means to fix the error : This is where the real work comes in. Syntax errors are easier to fix. So what do you do when you can't think of anything?:
Do a google search, you can copy the error prompt into the search bar. Chances are someone has encountered that issue before or there are similar issues already fixed. A guide to searching effectively on google.
Post the questions on online Q&A communities like StackOverflow- the most popular, Quora, Reddit, StackExchange, and more. Be sure to follow their guidelines for posting questions and also be polite.
For helpful contents you can also check Freecodecamp, MDN Docs, W3School, Netninja, and more.
Reach out to a senior developer or anybody more knowledgeable about the subject. Be polite, clear and concise with your approach.
Apply the solution : If you've figured out a solution, you can apply it. Then test the code/program out to be sure your solution works.
Tips to try when you're stuck
Take a break, do something else to clear your head, listen to music or whatever helps you relax.
Reevaluate your goals, remind yourself about what you aim to achieve.
Say your affirmations, if you don't have any then chant about your strengths and how you will overcome the problem
all these tips are garnered from developers who have been stuck too, it's worked for them and can be helpful to you too.
Conclusion
You've learnt how to debug and what to do when you're stuck. You've also learnt about helpful communities to check out. Remember that you're not alone and it's an opportunity to learn more and grow.
When next you're stuck on a project be sure to use the steps and tips.
if you have contributions to share please do so in the comments
all illustrations from Undraw.co
Top comments (2)
Awesome article Melanie, I love your illustrations.
Thank you, I'm glad you found it helpful😌