The book of Joshua is a great example of a biblical book that contains different genres (kinds of writing) that predominate in different sections of the book, and each has its reason for being there.
I think that when the average reader tackles a book like Joshua, a narrative or history-telling book of the Old Testament (OT), s/he sets out reading it as narrative, the genre that tells a story. And that is not wrong, because narrative provides the ‘matrix’ that holds the book together.
But embedded in the narrative is another genre that, as Robert Alter once pointed out in his essay, ‘Sacred History and Prose Fiction’ (in The Creation of Sacred Literature, ed. R. E. Friedman, p. 17), dialogue carries much of the meaning in OT narrative, and this is particularly true in a book like Joshua.
What appears within the speeches in Joshua, whether by God or by Joshua or even by others, is programmatic, of defining importance for the theological claims of the book, which determine how the narrated and recreated history is to be understood. That is why dialogue predominates when counted by verse in the earliest and latest chapters of the book:
Notice also the other main genre in Joshua here, which is usually called (from memory) ‘boundary lists’. We normally skip that section, or pay it little attention, but it could offer insights into what period that kind of detailed territorial information was in high demand, i.e. where in Israel’s history its first audience could be situated.
It seems to me that its relevance has to be pre-exilic. That would tie into the significance of the famous (or notorious) ‘to this day’ statements that are so abundant in Joshua and tip the hand to the time period in which the book was written. See Joshua 4:9; 5:9; 6:25; 7:26; 8:28-29; 9:27; 10:27; 13:13; 15:63; 16:10; 22:22; 23:9; 24:15.
Josh. 15:63 is a telling example; it reports the Jebusites of Jerusalem as not yet dislodged from there. Since this was something achieved early in David’s reign according to 2 Sam. 5:6-10, we have a clue that the Joshua map lists or much, most or all of the book might have been produced as early as this, in the 10th century B.C.