loading...

3 tips for easier debugging

skiilaa profile image skiilaa ・1 min read

Debugging can be a piece of shit sometimes. Here are some tips that may help you with debugging your project.

Comment

Comments are very important in programming. You can leave them anywhere to explain the code or leave notes. I usually don't comment anything, because it's just a small project that no one will use. If you want to extend it, or it blows up, please, for the love of God, go back and comment everything. When you are getting a bug report, it can be much easier to pinpoint what's up with comments.

Log

Logging is a possibility in (if not all) most programming languages. With logging, you can take note what users input in your service, and bugs can be easier to understand.

Visualize your Program Flow

If you use both techniques above, a program flow can be a cherry on the cake. You can look up the user input in the log, locate what the data goes through with the program flow, and see what can be an issue with reading the comments.

Epilogue

I hope I could help you to some degree in this article. See you next time!

Discussion

pic
Editor guide
Collapse
pawelsalawa profile image
Pawel Salawa

I recognize three stages of commenting throughout the career:

  1. I don't comment. It's waste of time and energy.
  2. I comment wherever I feel it's necessary. It saves time in future and helps others.
  3. Can I rewrite this part of code, so it does not need a comment? I will comment only otherwise.
Collapse
skiilaa profile image
skiilaa Author

That is true, but thinking as a beginner, I'd prefer to comment everything that's not console.log simple, just in case I'd forget what it is.