This excerpt is from this blog back in Feb 2011. Phil reflects on the goodness of God.
But let's not miss the point: God did not afflict Job in order to punish him for his sin. God was testing him, proving him, and strengthening his faith. God's ultimate purpose for Job was good,even though the immediate effect was calamity. This was not punishment for his sin.
Bear in mind on the other hand, however, that Job, as a sinful creature, knew he had no claim on any blessing of any kind. God could justly afflict him, because Job needed to be refined and strengthened. And God's ultimate purpose, as James 5:11 says, was compassion and mercy.
Consider this: Job's loss was temporary. All his afflictions were transient, passing tribulations that would eventually give way to an even greater weight of eternal glory. As Paul says in 2 Corinthians 4:17, Our "light momentary affliction is preparing for us an eternal weight of glory beyond all comparison."
Suffering is the price and prelude of glory. For Christians, the suffering is always temporary, and the glory is eternal, and infinitely greater. That is our hope in times of trouble.