Every major problem you come across can be broken down into smaller problems, and almost every one of those smaller problems has been experienced and solved by someone else. Simply searching for an error code or a clear description of the problem you face will bring you multiple potential solutions.If relevant results don't show up, increase the specificity of your search terms.This creates fewer potential points of failure and will make refactoring easier, if necessary.Error messages and warnings are provided for your benefit.Add as many logs as you like, as they are free to use and provide a means to search through the flow of data within your program while and after it runs.Add in breakpoints to watch as variables in your code are declared, instantiated, assigned values, or altered.
One of the most important steps of debugging is to prevent bugs from being created in the first place.
It hasn’t been stated in the Bible or any other ancient text that problems do not affect human beings, so it is rather peculiar when you see someone in a coffee shop having a meltdown because the internet is not working.
Here is basic template to solve most problems that you may encounter: When the problem hits, your instinct is to panic and hope for a quick fix that ends it for all eternity, but most problems can’t be immediately solved, and expecting to solve them in such a manner will just increase the intensity of your panic.
Try to apply this priciple at each scope of your code.
Ensure every variable, function, class, or other element you name is clearly descriptive of what it holds, returns, or does.