The Book of Job contains some of the most beautiful poetry ever written. It also contains some important theology.
Job is afflicted precisely because of his righteousness. Neither he nor his friends is able to contemplate that that could be the case. Job believes he is being dealt with unfairly. His friends believe that his protestations of innocence are evidence of hubris as well as other secret sins.
In fact, God has set Job up to do him great honor. In standing fast in the face of unfair calamity, Job vindicates God's trust in him.
This book gives us perspective that not everything that happens on earth is a result of human action. There is also a spiritual dimension that we do not see. That realization should serve to make us very charitable toward our brothers when they are being afflicted.