Second Samuel 11:112:15a is a record concerning David's indulging sin and God's punishing condemnation.
David committed the sin described in chapter eleven in the time while Joab and David's servants were fighting against the kings of the Canaanites. David had sent out Joab and his servants, but he himself remained in Jerusalem (v. 1).
After all the enemies of Israel were subdued and David was exalted as the king of Israel, David committed a great sin while he was in a peaceful situation. This indicates that whenever we are in a peaceful situation, it is easy for us to be seduced to indulge our flesh.
Verse 2a tells us that late one afternoon David rose from his bed and went for a walk on the roof of the king's house. Here David was enjoying a life of ease, and his sin was committed during a time of ease. Ease is a big spoiler. We need to labor, toil, and suffer. Instead of damaging us, suffering is a help to us. We need to be occupied with either laboring or suffering.