Two goals in raising children should be: make it easy for them to obey God (be Good) and make it easy for them to obey themselves (be self-disciplined). By obeying themselves, I am referring to the degree to which a person has to struggle to do what he or she has chosen to do (oftentimes,
needs to do).
Children are not animals. But there is a facet of human nature that is easier to see if we briefly consider dog training. A dog trainer wants to make the dog associate things the trainer wants it to do with something positive, and make the dog have an aversion to the things the trainer wants them to stop doing. When the dog does something the trainer wants, he immediately rewards the dog with a treat
and praises the dog. Over time, the dog will perceive the praise much like he was receiving a treat. One approach for associating unwanted behavior with something negative, but is not painful, is for the trainer to turn his back to the dog and ignore it
and say something like "no!" This takes advantage of the fact that dogs are social and love the approval of their trainer. The dog will hopefully acquire a negative perception of things he isn't supposed to do, as well as making a "no!" command useful for stopping it from doing something he is about to do. (It is important however that the dog not become afraid of the trainer, because it will become a response to people other than the trainer, as well, and in extreme cases will make the dog have anxiety and/or fear all the time.)
This illustrates an association dynamic that is true of all humans, including adults. It's a lot easier to get oneself to do something when one associates it with good feelings. And it can be nearly impossible to get oneself to do other things when the thought of it brings up a feeling of emptiness or something negative.
Ideally, a person would have a good feeling when anticipating something he or she needs to do, and have a bad feeling when considering doing something immoral. It would make being a good person (and life in general)
a lot easier and more enjoyable.
If done properly, spanking is an option for associating something immoral with pain (such as disobedience when the child knows better). This may very well make it easier for a growing child to live in a Godly way and enjoy it as well. It benefits the child in the long run to have an ingrained negative response when considering doing something immoral.
One can conclude from Deuteronomy 21:18-21 that it is
very bad to allow a child to be rebellious (for themselves, God, and other people). It would appear that in extreme cases any and all actions a parent might do are permissible if it would work their child away from rebelliousness. However, it makes a huge difference that the community mentioned in Deuteronomy would have supported punishments vs. today, when all a child's friends are rebellious to some degree and their parents may be doing little about it. Nonetheless, it is clear that disobedience (rebelliousness) cannot be tolerated.
Failing to discipline a child when appropriate will have the effect of making his life worse in the future. It makes it a lot easier to understand what "hate" refers to in:
He who spares the rod hates his son, but he who loves him is careful to discipline him. (Proverbs 13:24, 1984 NIV)
You might consider (re)reading
blackribbon's post above for one approach to child discipline based on good principles.