It's critical for Christians to recognize the difference between punishment and discipline. Punishment has to do with the law, exacting penalties for sins against the law. It is not corrective (ex: hell isn't corrective) but is punitive only. Punishment vindicates God's injured majesty and violated justice. It brings joy to God, but it does not bring joy to the sinner. Discipline, on the other hand, has to do with the gospel. It does not mete out the sanctions of divine justice but comes from the loving hand of the Father to his sons (Heb 12:3-17). God's disciplinary providences toward his children are gifts of grace because they are aimed at sanctifying believers for their own good and growth in godliness. Discipline aims at the happiness of its recipients. The Puritans used to say that when God brings discipline into our lives, we should "kiss the rod" of correction.
Often God's Fatherly discipline exposes our sin and brings it out into the open, as in the case of David, and strips us of our idols by painful force. Perhaps David's idol was his high and exalted status as king. He was of such standing in the sight of the people that he felt free to remain home while his armies were at war. David felt free to order Bathsheba to come to him and to have her for himself. He was on a power trip and he felt he had the approval rating to sustain it. But, his lofty status and widely popular approval likely plummeted when his sins were made public for all to see. David wasn't as great as many thought. David's over-blown self-image was ripped away from him by force through God's gracious discipline for David's own good.
So, how should Christians be motivated by God's corrective discipline? We should think about the fact that our sins will either be mortified and godliness vivified through willing application to Christ or our sins will be painfully ripped away from us by discipline. Either way, God will sanctify us. Which way will you grow? Will it be through faithful application to the cross of Christ, or will God expose your sins and will your idols be ripped from you by God's merciful discipline?