As for you, you meant evil against me, but God meant it for good in order to bring about this present result, to preserve many people alive. Genesis 50:20 (NASB)
Joseph’s brothers meant evil against Joseph just as Satan sought to harm Job (Job 1). God set limits as to how far Satan could go in that harm, and He set limits upon Joseph’s brothers’ schemes to harm him. Joseph, like Job, understood God’s sovereign control and His limitations on secondary causes such as Satan, the sins of people, and even natural disasters. 
In Joseph’s case we see that Joseph saw how God let things run their course to accomplish some greater goal that was invisible to Joseph—when he was in the pit, when he was falsely accused by Potiphar’s wife, and when he was in prison for a crime he did not commit. God used all of those circumstances behind the scenes to accomplish something that brings glory to Himself—the figurative salvation of many people who would starve without Joseph’s intervention forgiveness of his brothers.
And we know that God causes all things to work together for good to those who love God, to those who are called according to His purpose. Romans 8:28 (NASB)
To understand Romans 8:28, we must first understand that every book in the Bible is somehow about Christ and God’s plan in redemptive history. With this is mind, we see that Joseph in many ways parallels Jesus Christ in the New Tes­tament and serves as a type of Christ, that is, a type of Savior In other words, in the story of Joseph, who saved his people from physical hun­ger, we see a picture of the coming Christ who would save His people from their spiritual poverty and hunger.
Romans 8:28 does not tell us that all things are good. It tells us that God uses all things for the good of those who love Him. While we, like Job and Joseph, often do not understand exactly how God does this one thing, we can be sure that He uses these things to help us become more like Christ.
In the end, Job repented of questioning God, he was humble, thus reflecting the nature of Christ, who humbled Himself (Phil. 2:6-8) so that those who believe will be saved.
Joseph forgave those who sinned against him, thus reflecting the forgiveness of Christ when he died on the cross.
The doctrine of God’s absolute sovereignty ought to be a great comfort to us because we know God is using all of our circumstances, and all of our trials to help us become more like Christ in our responses to these troubles. God promises us that whatever the circumstance we need not sin in re­sponse to it, and that we will, by His grace, be able to endure it.
Once we understand that God is in absolute control of each and every situation, we can step out in faith and trust Him because God will allow nothing to detract from His glory; and he will allow nothing to detract from the ultimate good of His people. Romans 8:28-29 is a promise. It’s a promise that no matter what happens, we can be assured that God is working behind the scenes for the ulti­mate good for those that truly love Him.
This is why when faced with adversity; our faith must triumph over our feel­ings. There is purpose in our adversities; and while we may not totally under­stand the bigger picture, we can understand that God is using all things to make us more like Jesus (Rom.8:29).