Some people think corporal punishment is always bad. I think it can be appropriate if used sparingly and within certain guidlines.
The first thing to consider is: What is the motivation for discipline? The primary motivation for discipline should be for the betterment of the child. Discipline is NOT be used for the convenience of the parent. For example the parent shouldn't spank the kid because he/she (parent) is too lazy to use a more appropriate punishment that takes more work to put into place.
Another consideration: Never punish for an accident. Don't spank the kid for spilling his milk when he didn't mean to.
How hard to spank? Corporal punishment should never leave a bruise or mark.
How often? Corporal punishment should be rare. If the parent uses it all the time, or for trivial reasons, it loses its effectiveness.
How old? There is a certain age window when corporal punishment is most appropriate. Age 3 to 10 is what I've decided on. It doesn't do any good to spank a baby, because he/she doesn't understand what's going on. And pre-teens are getting too old. There are other punishments that can be more appropriate and effective for pre-teens (grounding, loss of privilege, etc).
Corporal punishment should never be done in a way that embarrasses the child. It should be done in private in a manner that is respectful to the personhood of the child. Fathers disciplining their daughters should take special precaution here.
Never spank when angry. The parent must take time to evaluate the situation and think through what punishment is most appropriate.
When? Punishment needs to be at the “right” time so the child associates the punishment with the bad behavior. It should be fairly close to the time of the event. For example you wouldn’t punish a three year old for something they did a week ago. Their sense of time has not developed to the point where they can still associate the punishment with the act.
Who? In most cases parents are the only ones who should spank. Teachers and relatives should not be using it. In cases of blended families it should be done by the parent, not the step-parent.
Why? It helps the child to associate pain with an inappropriate behavior. Just like skinning the knee when careless, or touching the stove when it's hot. Pain is a powerful motivator.