The writers of 1 & 2 Samuel present David as a complex and sometimes contradictory character. David is not at all a perfect hero: Collins notes that parts of 1 Samuel depict a David who is at best a mercenary and at worst an outlaw (152-3). Collins notes that even the "History of David's Rise" (1 Sam 16:14--2 Sam 5), which tries to paint a more sympathetic picture of David, still leaves readers with the impression that the text is little more than "a propaganda document" (151). However, 1 Samuel also includes some of the more positive attributes of David, including the various stories of his rise that show David as, subsequently: a lowly person who becomes exalted (1 Sam 16:1-13), a skilled musician who is admitted to the royal court (1 Sam 16:14-23) and as a brave and effective warrior (1 Samuel 17). (Collins 151) This trend continues in 2 Samuel, where David's evil deeds (e.g. 2 Sam 11-12) are depicted along with his positive qualities (e.g. 2 Samuel 7).
Wright makes the compelling argument that the Deuteronomistic history satisfies a particular function for the development of Israelite identity. Specifically, the Deuteronomistic history provides evidence of Israel's existence as a people or nation that is independent of the state institutions of Israel (93). In the Deuteronomistic history, Israel sees the rise and fall of a variety of institutions but does not lose its identity as a nation. This is true throughout the history as Israel moves through its various stages: invasion of the promised land (Joshua), a lose confederation of tribes (Judges), a united kingdom (1 & 2 Samuel) and a divided kingdom (1 & 2 Kings). God will vindicate God's own power and will by lifting up or setting down these institutions, but God does not abandon the chosen people of Israel (Wright, 84-6).