David was a man who was not perfect. He had failings. One of the most notable ones is his adultery with Bathsheba and murder of her husband, Uriah (II Samuel 11). But he was also truly repentant (II Samuel 12).
The most important thing to remember about David is that he was fully committed to following God. Psalm 23 can be viewed as a reflection that David made about God and himself. He was not perfect but he was willing to go and do whatever God’s will was for him.
David became King of Israel at the age of thirty and served as king for forty years (II Samuel 5:4). Forty years of facing numerous problems from being hunted by King Saul, family strife, loss of his infant son, and many others that he faced.
Psalm 23 is power-packed with David’s acknowledgement that were it not for God being his Shepherd, he would have perished. Imagine him sitting somewhere reflecting back to all that has taken place. Marveling, if you will, that he is still here, still breathing.
At the same time being thankful for God’s guidance in his life. As he ponders on everything his heart fills to overflowing with love for this wondrous Shepherd who led him through all of the obstacles. Grabbing a pen, he quickly scribbles these words:
“Thou preparest a table before me in the presence of mine enemies: thou annointest my head with oil; my cup runneth over (Psalm 23:5).”