DEV Community

Faith Morante
Faith Morante

Posted on

Debugging tip for backend programming

In over 5 years of professional programming, I have to say personally most of the toughest daily tasks to do is debugging. Especially user journeys where you don't know why a certain thing happened. You try to replicate the problem, but there are times that it just seems to be a big mystery.

I know logging and audit trails can help, but I have thought something more of an easy way to do it.

On every insert and update transactions, the DB table should have two columns: file_name and function_name

file_name: this means the transaction happened in this file. This helps when your repository is huge and there are multiple transactions in same table in other parts of the codebase

function_name: this drills down which part of file the transaction happened. Line numbers doesn't have to be saved since they are mostly changed as time progresses and codes change by the team.

So that's it, it has helped me in a particular "mystery" case. What do you think about it? Have you used this? Is this helpful? What are your debugging tips?


Discussion (0)