With the right outlook and training, you can condition yourself to avoid sinning. (not all the time, of course, but for the most part) Even if you aren't a believer, your life here on earth will be better for it.
That's the idea behind spiritual growth and also raising people with values...Honor codes reflect that as well, if done properly. All good stuff comes from God, I believe, even when it's not the complete message of salvation...and the need for order and the things that make happy lives are known to some degree everywhere. Ethics. Values. Honor.