How to debug the Wolfram code?

How to debug the Wolfram code? Any hints will be highly appreciated.

Regards,
HZ

I run many snippets to see which ones fail to give the expected results. Then I put them together in more and more complete structures to see if the structures give an expected result. When they all work, I put the whole code together, and if I put it together properly it works!