Being careful is not the solution. You cannot be careful all the time. Sooner or later, you will let you guard down and make a mistake. It is inevitable. If you are lucky, this mistake will occur when you have loads of time to diagnose it. If you are unlucky, you'll get a bad build at the 11th hour.
When you find that you need to be careful, you should ask yourself, how can I change this situation so that mistakes are either impossible to make or discovered immediately after making them?
If you think about it, you probably already know a few strategies for achieving this right now:
- Unit tests insure that your classes behave as you expect them to.
- Asserts (Design by Contract) achieve the same thing from a different direction.
- Code generation eliminates duplication, so that you only have to make a change in one place.
- Static type checking catches mistakes at compile time.