David is surrounded by foils, including Uriah Heep, James Steerforth, and Tommy Traddles. Each of these other characters represents a different version of who David might have become under different circumstances.
Uriah is a lower-class version of David. Because Uriah comes from less money than David, he must be more ambitious to get as much power and status as David. Uriah constantly reminds David of this by calling himself "umble." Uriah is far from humble in his character, but he does come from a humble background and lacks Aunt Betsey's money to give him a leg up. The novel ultimately suggests that the major difference between Uriah and David, whose careers take similar paths, is that Uriah's moral character is lacking in comparison to David's. This lack of moral character leads Uriah to commit crimes and burn bridges; it is why he ends up disgraced and in prison. Uriah's character flaws allow the novel to punish him and treat him as a villain without suggesting that poor people are inherently villainous. Still, class background is part of the equation. David's ability to maintain his integrity while he climbs the social ladder is undeniably related to his social connections, especially to Aunt Betsey and her money. Uriah, on the other hand, becomes corrupted because he is bitter about the lack of opportunity afforded a working class person. The novel thus uses Uriah and David as foils to comment on the way class division can corrupt someone's moral character.
It is not only class status that can corrupt, though. Steerforth, another foil for David, comes from more money and more snobbishness than David. Most importantly, he is coddled by his mother (this is somewhat true for Uriah too). All of this results in a sense of entitlement. Steerforth uses people to get what he wants, and then he throws them away. Because David comes from modest wealth and security but still must develop a sense of self-sufficiency, he doesn't turn out like Uriah or Steerforth. Dickens uses these foils to advocate not for the expansion of the upper class, but rather for the expansion of the hard-working middle class. Indeed, middle-class Traddles is in many senses the happy medium and the ideal model for David. David and Traddles encourage each other throughout their lives to become industrious and successful men with good careers and happy families. They each become financially stable enough that work becomes a noble pursuit rather than simply a matter of survival. Both of them chase wealth as a means to family stability and self-fulfillment, not wealth for its own sake.
Peggotty and Clara Copperfield are foils for one another, representing opposite types of mother figures in David's life. In Chapter 5, when Barkis asks for Peggotty's name, David reveals that his mother and the woman who has helped her raise him share a first name:
‘Her name?’
‘Ah!’ said Mr Barkis, with a nod of his head.
‘Peggotty.’
‘Chrisen name? Or nat’ral name?’ said Mr Barkis.
‘Oh, it’s not her christian name. Her christian name is Clara.’
‘Is it though!’ said Mr Barkis.
David does not use "Clara" to refer to either his mother or Peggotty, and they remain entirely distinct figures in his mind. But by giving Clara Peggotty and Clara Copperfield the same first name, Dickens ensures that readers will compare the two women. Peggotty, like David's mother, is with him from the moment of his birth. They are the two primary caretakers of his childhood. David's mother is a less-than-successful parent. She loves him, but she consistently fails to protect him. Afraid to stand up to Mr. Murdstone, she allows him and Miss Murdstone to mistreat David however they please.
Peggotty, on the other hand, more than succeeds in her caretaking roll. She does not have to love David as a mother because he is not her biological child. Nonetheless, she is the one who protects him. She tries to convince Clara Copperfield not to marry Mr. Murdstone, who she suspects of being an abuser or at least of being a poor match for David's mother. When this endeavor fails, Peggotty takes David to her family in Yarmouth. Here, he sees a big, loving family for the first time. Peggotty later talks to David when he is shut in his room by Mr. Murdstone. She always does her best to make sure he never feels abandoned to the abuse, and that he knows there are happier families out there. Peggotty and Mr. Barkis even end up being surrogate parents for David in a financial sense, when Mr. Barkis dies and names David in his will. Where Clara Copperfield fails, Peggotty teaches David about the many ways of creating a loving and supportive family.
Next to each other, the two Claras in the novel have all their traits thrown into sharper relief. The narrator never sets aside his love for his mother, and he never doubts that, imperfect as she was, she loved him. Still, as David becomes the reader and writer of his own story, he seems to realize that Clara Peggotty provided a great deal of mothering in his life. His ability to appreciate an unofficial mother figure extends to other characters. Aunt Betsey, for instance, mothers David. Even Mr. Dick is a kind of father figure, as is Mr. Wickfield. For a novel that treats happy nuclear family life as the ultimate form of self-actualization, David Copperfield also makes a great deal of room for unconventional family structures. Dickens seems committed to the idea of the nuclear family, but he is also interested in critiquing traditional marriage and family structures that do not live up to their name. The ideal situation, the novel suggests, is to have a traditional marriage and family that is just as loving as the Peggotty family.
David's two wives, Dora and Agnes, are foils for one another, representing different paths of development for David. In Chapter 44, Dora asks David to call her his "child-wife:"
‘Will you call me a name I want you to call me?’ inquired Dora, without moving.
‘What is it?’ I asked with a smile.
‘It’s a stupid name,’ she said, shaking her curls for a moment. ‘Child-wife.’
Dora's desire for David to call her his "child-wife" seems related to the fact that he liked her childishness when they were courting. He has been critical and mean about her difficulty keeping house during their marriage, but if he remembers that he fell in love with her childishness, they might have a happier marriage. Dora's desire to be thought of in this way is not only devastating for her, but also for David. His meanness to Dora is beginning to parallel Mr. Murdstone's meanness to Clara Copperfield. Like Clara Copperfield once did for Mr. Murdstone, Dora hopes to keep David calm by playing up her own incompetence and powerlessness. Just as it was when David's mother died, it is tragic when Dora dies. Nonetheless, her death is also a gift as far as David's development is concerned. He may become depressed for a time, but he is also saved from becoming a mean and even abusive husband permanently.
Agnes is equally enchanting to David. She is far more self-assured than Dora, but their differences lie chiefly in the different feelings and behavior they inspire in David. David thinks of Agnes as a sister before he finally realizes that he is in love with her. Although there could be something incestuous about his falling in love with someone he thinks of as a sister, it seems to have more to do with a sense of equality. If David thought of Dora as a permanent child to his ever-developing adult self, he thinks of Agnes rather as someone who is growing up alongside him. Agnes, who David also thinks of as a "good angel," is a partner who can help David succeed rather than a "child-wife" to take care of. Their equal relationship stands in stark contrast to David's unequal relationship with Dora.
Dickens has been criticized for writing flat women characters. Dora and Agnes are potentially very interesting and well-rounded characters who could be explored more fully. Agnes, who David sees as his equal, certainly has more of her depth represented than Dora does. Still, the way these two characters function as foils, it is clear that they both serve primarily to represent different paths for David's character development. This is in part the fate of any secondary character in a Bildungsroman, especially one narrated in the first-person: the novel's main goal is to explore the protagonist's growth.