It's not about being sinless, it's about being repentant...King David committed some big sins. But his life is remembered as godly because of one major aspect of his character.
David had a remarkable ability to honestly repent of his sins. He knew that unrepentant sin would separate him from God, and he loved God too much to let that happen.(1)
"If we claim to be without sin, we deceive ourselves and
the truth is not in us. If we confess our sins, he is faithful and just
and will forgive us our sins and purify us from all unrighteousness. If
we claim we have not sinned, we make him out to be a liar and his word
is not in us." 1 John 1:8-10(2)
Christians who minimize their sins build walls of carnality, hypocrisy, and weakness in their lives. They may claim "that's just the way I am" or offer other self-defense excuses.
In contrast, there are Christians who honestly face their sins and humbly repent. They typically display 6 Aspects of Godly Sorrow. Most importantly, they bring purity and renewal to their relationship with God (Psalm 51:10-12).
When we sin, let's sincerely repent!
I encourage you to compare David's sincere repentance with King Saul's insincere repentance: Anatomy of an Insincere Repentance.
------------------------
(1) "Repentance" as used in Scripture (e.g. 2 Timothy 2:25)
involves a change of heart and mind. If we repeatedly confess a sin
without determined efforts to avoid it, we have not sincerely repented
of it. These passages should inspire us to be honest, humble, and repentant:
Psalm 66:18: "If I had cherished sin in my heart, the Lord would not have listened."
See I'm Not Listening.
James 4:6-10: "'God opposes the proud
but shows favor to the humble.' Submit yourselves, then, to God. Resist the devil, and he will flee from you. Come near to God and he will come near to you. Wash your hands, you sinners, and purify your hearts, you double-minded. Grieve, mourn and wail. Change your laughter to mourning and your joy to gloom. Humble yourselves before the Lord, and he will lift you up."
Isaiah 66:2: "These are the ones I look on with favor: those who are humble and contrite in spirit, and who tremble at my word."
Psalm 145:18: "The LORD is near to all who call on him, to all who call on him in truth."
Psalm 51:17: "My sacrifice, O God, is a broken spirit; a broken and contrite heart you, God, will not despise."
(2) The Greek word
translated "confess" in this verse means to promise, agree, confess,
declare. It's more than simply admitting to a sin. It's agreeing with
God that what we have done is wrong.
I encourage you to check out the Wisdom for Life Devotional. It contains 100 one-minute devotions to challenge, encourage, instruct, and inspire your love for God's Word: Wisdom for Life. Read the story behind Wisdom for Life HERE. And find out about the two free Bible studies with purchase HERE. You can read the first 4 devotions in the book by clicking "look inside" on Lifeway or Amazon.
I also encourage you to sign up for a free subscription to Bible Love Notes and get a free e-booklet. Find out more HERE.

Bible Love Notes