There is so much to learn from David. We should learn both from David’s successes and failures. If you can learn from others mistakes you are wise instead of having to make the mistake yourself to learn.
Does David trust to much in his own righteousness regarding God’s blessing? I am not seeking to be dogmatic on this point but it is interesting to consider.