One of the foundational concepts in the literary criticism of the Hebrew Bible in general and the Pentateuch in particular is the notion that the various literary components, whether small or large, were put together by redactors or editors rather than authors in the modern sense.
Some regard part of the David story as the pinnacle of ancient Israelite historiography and a product of the Solomonic "enlightenment."