Limited knowledge of the future and of all possible concomitant circumstances drastically curtails our ability to make any certain plans at all. ... God, however, does not see things this way. ... By nature, He is incapable of being surprised. God is not a reactionary whose next move depends on something or someone outside of Himself. As the absolute Sovereign, He is totally and uniquely independent and unaffected by external agents. As Nebuchadnezzar's confession puts it: "He doeth according to his will in the army of heaven, and among the inhabitants of the earth: and none can stay his hand" (4:35; see also Psalms 115:3 and 135:6). ... God is in so much control that He factors in the opposition as part of the decreed means of accomplishing His perfect will. The biblical record makes this perfectly clear.
... It doesn't surprise the Lord, and therefore, it shouldn't surprise us when we find ourselves engulfed in the conflict. ... Letting us know about the opposition up front is a way for the Lord to encourage us to faith and confidence when the opposition comes. I think, for instance, that this partly explains why God told Moses beforehand that He would harden Pharaoh's heart, leaving the divinely manipulated king in turn to harden his own heart and refuse to let the people go. ... Pharaoh's opposition was a built-in contributor to the achieving of God's glory, the ultimate aim of all God's plans (Exodus 14:4, 17). ... So rather than sinking in despair when we encounter opposition, we should echo my imagined words of Moses, "Yes! I love it when a plan comes together."
Michael P. V. Barrett, God's Unfailing Purpose: The Message of Daniel, (Greenville: Ambassador Emerald International, 2003), 92, 94.