You’ve got an error, and you haven’t a clue what is going wrong nor do you know where to start in troubleshooting. I’ve seen it time and time again with programmers wasting precious time because they haven’t gone through the correct steps when it comes to troubleshooting coding errors/problems/bugs. So, here is my 7 steps to success for fixing coding problems in the quickest fashion. Keep your code clean with professional New York web design firm.
1. Walk through the code yourself
You are your worst enemy. More likely than not, you have made a mistake yourself. But that’s ok, you are only human. Walk through your code, from the top, line by line, to ensure all the logic is correct. Keep a look out for any syntax issues like using = instead of == (that gets me all the time).
2. ‘Can you hear me now?’ technique
Credit to Verizon for their late 90s TV adverts. The idea is that you echo/print out ‘can you here me now’, ‘hello world’ or ‘loser’ throughout your code until you start spotting where the echo isn’t coming through as it should. This is particularly handy for WSOD (White Screen of Death) problems.
It’s also worth echo’ing about variable values to see when they change.
3. Have a fellow coder have a look
If you work in a team, get your fellow coder to have a look. You’d be surprised what they will spot within 10 seconds that has taken you an hour. Yeah, they will probably put you down for it, but hey, it’s all good.
4. Google It (for 10 minutes)
More likely than not, there is someone else who has had the same problem. Google is your friend!!! Google the actual error or what you think someone else might google to find an answer like ‘PHP isn’t assigning my variable’. In most cases, this solves the problem. BUT, don’t spend more than 10-15 minutes doing this.
5. “StackOverflow It”
You, your fellow coder and Goolge can’t find the answer quickly. It’s time to throw it to the mass programmer community that is StackOverlow. Probably the best Q&A site for programmers since discussion forums were the cool thing.
But, make sure you craft your question well (and check previous questions). Here are some quick ‘mini’ tips for crafting a good Stackoverflow question:
- Be clear and to the point with your question’s title.
- Be clear and to the point with your question. Programmers are lazy and sigh when they see a page with at least 2 paragraphs.
- Provide example code if possible (make sure you remove any passwords/etc)
- Don’t get defensive. These guys are here to help. It’s not their fault they are programmers and thus lack social skills.
- Oh, and make sure you mark a correct answer. It will help you in the future.
6. Keep Googling It
While your stackoverflow question is ‘boiling’ away, keep Googling. You’d be surprised what you might end up finding after. BUT, if you do find an answer at this stage, make sure you answer your own stackoverflow question.
7. Sleep on It
Sometimes, having some time away from the problem and clearing your head makes things so much more obvious. Don’t continue bashing your head agaisnt a wall. Walk a way from the problem, find something else to do for a while. When you come back to the problem you might see it in a different light and know the solution.