A thorny problem in the interpretation of the book of Samuel is the chronology of chapters 16ff. As most commentators look at this section of the book, Saul gets rejected as king in ch.15 (as he had in ch.13), Samuel arrives in Bethlehem to anoint David in the first half of ch.16, David gets called to Saul's side to play soothing music to calm him, a David unknown to Saul shows up to fight Goliath in ch.17, and then Saul rewards David at the end of the chapter. Then early in ch.18, Saul keeps David in his court, which he'd already done at the end of ch.16.
Some people try to avoid the problem simply by saying there are multiple accounts that conflict with each other that were all spliced together by some complete idiot who didn't know how to compile a book to save his life. The problem with such a view is that the author of Samuel is extremely careful, with an overwhelming number of subtle hints here and there and with a fairly consistent unity of style. The sections of the narrative are constructed in clear patterns throughout, with thematic progression and careful literary skill on a much more global level than just with the details within each chunk. There may have been multiple sources for the book, but the author made them his own. He wouldn't have left things so ridiculously conflicting, all within a few chapters, that the common picture you get from modern scholars would result, with this haphazard arrangement of contradictory reports that some editor just threw together because he didn't know what to do with them otherwise. So what's going on in this section of the book?
The most common suggestion from those who want to defend the author(/editor) from the charge of complete idiocy is that it's just not a chronological account and wasn't intended to be. The most plausible reconstruction I've heard at this point is that David gets anointed, which is followed by the events of ch.17 with Goliath, and then Saul calls David as a musician to soothe his spirit from time to time, which is followed by Saul's permanent calling of David to his court, which is reported both at the end of ch.16 and at the beginning of ch.18 to remind us that we were now at that chronological point again.
I hadn't seen a plausible accounting of why such a masterful author would have chosen this exact ordering until the sermon on Sunday, when our primary teaching elder suggesting the following motivation. Saul was finally rejected in ch.15, and Samuel reports this to Saul at his final encounter with Saul before he dies. He then anoints David in the first half of ch.16, and this event begins the foundation for David's approaching reign. Since David is the primary character of the rest of the book, even while Saul is still king, this makes sense to start out with the foundation of David's reign. The rest of the foundation of the rest of the book is to typify what sort of king David will be like. The people had asked for a king like those of the surrounding nations, and they had gotten one. The chapters between Saul's introduction and his final rejection as the kind of king God will choose typify what Saul is like. He's impetuous, lacking in common sense, favoring mere ritual piety over a concern for right relationship with God, more concerned with what his people think than what God thinks, disobedient to God's commands through his prophet, and so on. Jonathan has served to this point as a stark contrast.
Now the one who will truly contrast with Saul as a different kind of king has arrived on the scene, and the author displays the differences. In the anointing scene, we see that this is God's choice, and God doesn't choose by the outward signs that Samuel expected (e.g. Eliab looks kingly but is not God's choice). Now we see two aspects of David's kingship that will run throughout the rest of Samuel. David is the sweet psalmist who will reorganize worship in Israel. He's the shepherd who cares for his sheep. He's loved by all, including Saul and Jonathan (until Saul's irrational fear of competition gets the better of him). The scene of David calming Saul with his music shows this side of David, and since that's the primary element necessary for kingship it comes first.
Then we see David as the man of war, the man of blood, who kills the giant and cuts his head off. Shortly after that we see him meeting Saul's demand of bring back 100 Philistine foreskins. The shepherd protects his sheep, killing off lions and bears, and David will do the same for Israel against the Philistine threat, pacifying them completely. These sections thus serve as the foundation for the rest of the book by bringing out these features of David in exactly the order the theme requires. There are enough signals, according to this view, that tell us the chronology that this literary pattern is supposed to explain.
I said I think this is the most plausible account of a chronology for this section that takes it as being not in the proper order. This literary explanation does seem plausible to me. If we truly can't reconcile the chronology as the book stands, it might be the most likely explanation. I don't think it's the best approach, however. It occurred to me after the sermon that there was one feature of this account that all the authors I've read have missed, and it turns out that the elder who gave the sermon on Sunday arrived at the same conclusion completely independently of my own thoughts on it. He's now produced an argument that the account as it stands might be in order both thematically and chronologically.
An observation is necessary, first. Even ch.17 has internal problems, when read through the eyes of a modern scholar. I picked up on this when reading through Ralph Klein's commentary on I Samuel. Klein claims that there's a contradiction even in ch.17, because Saul calls for David earlier in the chapter as if he knows who he is but then doesn't seem to know who David is later on when rewarding him. Klein's conclusion is that even ch.17 is spliced together from different sources. This made me look again at both pieces of evidence. Nowhere in the chapter does it say that Saul didn't know David. All it says is that he wanted to know whose son he was. He was told whose son he was at the end of ch.16, but it's much more plausible that Saul would forget whose son he was than that he'd forget who David himself was. So it's not clear at all at the end of ch.17 that Saul doesn't know David. Thus is solved the internal problem of ch.17.
But what's really interesting is Klein's claim that Saul does seem to know David earlier in the chapter. The text doesn't come out and say this, but Saul simply hears that David had said some things and sent for him. The only thing the text reports of their conversation is David's defense of why he thinks he can be a good warrior against Goliath. We get none of the questioning of who his father is that we get both earlier at the end of ch.16 and later at the end of ch.17. Should we assume that Saul already knew who David was? We can't assume that for sure, but we have no reason to rule it out, and it makes sense to read ch.17 with the sense that Saul already had some familiarity with David, which ch.16 would explain. If he furthermore had already developed a liking for David, it might explain why he'd risk a small warrior going against such a huge giant. That strikes me as one of the strangest elements of ch.17. Why does Saul go along with this? The best explanation I can think of is that Saul already knew David and liked him very much, so he was willing to trust him on this.
If this is all right, then it's fairly straightforward to defend both the integrity of the text and its chronological ordering. David was privately anointed. He was then summoned to soothe Saul musically, and Saul called David to enter his service (though it doesn't say explicitly at the end of ch.16 that this was permanent; presumably David went back to shepherding in between). Then the Goliath episode takes place, and Jesse sends David to deliver food to his brothers and check on the battle. Saul trusts David enough to let him fight, and then rewards him afterward. Even though he'd once been told whose son David is, he forgets and asks again. At that point (18:2) Saul calls David to permanent service at his court, and Jesse needs to find a new shepherd.
The thematic and chronological ordering might well coincide. This does take a good deal of thinking through to arrive at, but it strikes me that some of the moves I had to make to work this out are fairly obvious if you just look at what the text says and what it doesn't say. I have to wonder how it is that such good scholars can miss such things, but I think it's from reading these texts with certain presuppositions about how editors uncarefully lift contradictory sources and put them up against each other without much thought. If you don't start with that assumption, you don't get that conclusion.
Addendum: After I wrote this post, I took a look at some of my other commentaries on Samuel, and it turns out Robert Bergen defends the chronology I've just given, though he doesn't do it in exactly the same way. He doesn't make all my considerations explicit, but he does give one further element that I think is worth noticing.
Those who have defended the chronology this way in the past have taken the dubious stance that Saul must simply have forgotten that David was the well-loved member of his court who played music to calm him whenever the injurious spirit would torment him. That seems pretty unlikely, but they usually insist that we see irrationalities in Saul later on. He knows fully that David has had opportunities to kill him but hasn't done so, but he still acts as if David wants to kill him. This doesn't seem to be a memory problem, though, but some element of irrationality, of knowing something but still being unable to overcome his need to remove all competitors, partly due to Samuel's declaration that God had rejected him as king and would replace him with a better man.
Well, Bergen doesn't take that sort of solution, but he does point out one thing that's right about it. If this chronology is correct, then Saul has forgotten whose son David is, which means he's forgotten an important detail about one of his most beloved members of his court. It's much more believable that this is all Saul forgot, but it also makes sense within a more reasonable sense of Saul's having memory problems. He can't even be a good enough king to remember whose son his beloved musician is. If that's the narrator's point of having Saul ask the question at the end of ch.17 that Saul had already asked at the end of ch.16, then it makes perfect sense.