Defensive Coding
Just a quick word on Defensive Coding:
You can write very secure code that isn't defensive. #DefensiveCoding isn't just about secure code. It's about making your code more maintainable, easier to read, understand, and user-friendly ("user" being other developers interacting with your code.)
1) Follow SOLID principles
2) Reduce code smells
3) Design your code the way you would your UI/UX. Make it simple, straightforward, intentional, and handle user error where possible.
This will help you reduce the risk of new bugs and save you tons of time when you have to revisit your code base.