This passage is from Nathan who is taking David to task for the whole drama with Bathsheba. David basically had her husband killed so he could have her for himself. Obviously, God had a little problem with this. David thought he was so slick and secretive that he did not even realize that he had sinned against God. He was so caught up in satisfying his own needs and personal agenda that the thought did not even occur to him.
David had everything and God would have happily given him more but sin is never satisfied. He was selfish and greedy and wanted what he wanted. He got it but not with out consequences. We go against God to act on our own so that we can make ourselves happy and when things start to go south, we wonder why. David was utterly clueless to what he had done until Nathan came and let him know that all your business will be put out in the street.
There are somethings that we do in the dark or feelings that we secretly harbour that if they are not aligned with God and only serve to take us further away from him, will not stay in the dark for long. You and I both know that your secret sins have a way of coming out in the open and sometimes we are not even ready to deal with it.
Don't let God put you on blast. Don't let him expose your secret sins to the people you would least like to know. Confess them to Him, make amends, and deal with the consequences of your choices. We have to or else our skeletons will come tumbling out of the closet for all to see when we least expect it.