In Chapter 1, David compares Mr. Chillip, the doctor who delivers him, to the Ghost of Hamlet. This allusion is one of a great many allusions to Shakespeare's Hamlet:
He was the meekest of his sex, the mildest of little men. He sidled in and out of a room, to take up the less space. He walked as softly as the Ghost in Hamlet, and more slowly. He carried his head on one side, partly in modest depreciation of himself, partly in modest propitiation of everybody else.
The Ghost in Hamlet is Hamlet's dead father, who only appears to a select few characters but who catalyzes the entire plot of the play. The Ghost urges Hamlet to avenge his death. Hamlet quickly pieces together the mystery. Hamlet's father was the King of Denmark. Hamlet's uncle, Claudius married Hamlet's mother, Gertrude, right after the King died. As the widow to the now deceased King, Gertrude stands to offer quite a lot to Claudius. Hamlet spends the play believing (against the reassurances of most of the people around him) that Claudius killed his father. At the Ghost's bidding, Hamlet dedicates himself to taking his uncle and stepfather down.
The comparison between Mr. Chillip and the Ghost is somewhat ironic. Mr. Chillip is like the Ghost not because he is urging anyone on to avenge him, but because he is so mild-mannered that he's practically unnoticeable. Still, the allusion kicks off an allegory that runs throughout the novel, sometimes serious and sometimes ironic. Chillip delivers the news that David is a boy, which leads to Miss Betsey abandoning her plan to raise Clara Copperfield's baby. David thus gets stuck with Mr. Murdstone as a stepfather. Like Hamlet, David's antagonist is his stepfather. Like Hamlet, he is largely alone in his battle because Victorian society refuses to take domestic abuse seriously.
Many side characters in David Copperfield stand in for side characters in Hamlet. For instance, Dora is like Hamlet's love interest, Ophelia: neither David or Hamlet manages to set aside their own obsessions to properly care for their love interests, and both women end up dead. Mr. Micawber, meanwhile, frequently offers platitudes, just like Ophelia's father, Polonius, does. Both Micawber and Polonius are ultimately good people who get caught up in the plot as advisors to villains (Polonius to Claudius, and Micawber to Uriah Heep).
The stakes in David Copperfield are sometimes much lower than they are in Hamlet because David is just an ordinary person, not a Danish Prince. It would be difficult for anyone's life to have the heightened stakes of Hamlet's. Where David's story most differs from that of Hamlet is the happy ending. Part of David's development is outgrowing Mr. Murdstone as an antagonist. By the end of the novel, David has gained his independence and no longer must worry about his abusive stepfather. The end of Hamlet, on the other hand, is a bloodbath. Nonetheless, the similarities between their lives begs readers to take David's struggles seriously. For a child who grows up in an abusive environment without much of a social safety net, Dickens seems to be arguing, life can be almost as difficult as it is for the ultimate Shakespearean tragic hero.
In Chapter 13, David finds himself at his aunt's house after running away from the factory Mr. Murdstone has sent him to work in. His aunt, Miss Betsey Trotwood, alludes to the biblical story of Cain and Abel to criticize Clara Copperfield's parenting:
‘And then, as if this was not enough, and she had not stood sufficiently in the light of this child’s sister, Betsey Trotwood,’ said my aunt, ‘she marries a second time—goes and marries a Murderer—or a man with a name like it—and stands in this child’s light! And the natural consequence is, as anybody but a baby might have foreseen, that he prowls and wanders. He’s as like Cain before he was grown up, as he can be.’
Cain comes from the Book of Genesis in the Bible. One of the first two sons of Adam and Eve, Cain is most famous for murdering his brother Abel. His motive was jealousy: God favored Abel's sacrificial offering over his. God punishes Cain by cursing him to spend his life as a wanderer.
The allusion is somewhat of a joke. It plays on Betsey Trotwood's absurd wish to have things her way, as if she is God. She insisted that Clara Copperfield was supposed to have a girl whom Betsey could name after herself and raise as her companion. It seems that Betsey wanted to raise a girl so she could teach her to avoid the pitfalls she and Clara both fell into with abusive relationships. Betsey doesn't exactly hold David responsible for killing his imaginary sister, but she does think of him as an obstacle to the existence of the child she imagined.
Betsey's insistence that David is a little Cain, wandering and even "prowling," suggests that she does not hold out much hope for his future. In her view, David Copperfield has been cursed from birth by his mother's choices. Obviously Clara could not have chosen to have a girl, but she did choose to marry Mr. Murdstone. That choice has had an undeniably negative effect on David's life. At this point in his life, he is a wanderer with no home because he has been turned out of his childhood home and has run away from the factory to which Mr. Murdstone sent him to work. The allusion is a little absurd, but it also invites the reader to consider the extent to which David has control over his own destiny and the extent to which he has been "cursed" by parental figures.
In Chapter 19, the novel alludes to Shakespeare's play Julius Caesar. David goes to see the play, and the adult narrator reflects on the experience:
To have all those noble Romans alive before me, and walking in and out for my entertainment, instead of being the stern taskmasters they had been at school, was a most novel and delightful effect.
Sitting in the audience to view this play is an upward move for David. He's educated enough to know who the Romans in the play are, but he gets to see them perform for his enjoyment now. Education has seemingly contributed to his class mobility by both allowing him to understand the historical context of the play and by giving him the social and financial capital to attend the play with other well-off audience members.
The allusion also highlights the blurred border between real life and fantasy in David's narrative of his own life. Shakespeare's plays are generally classified as either comedies, tragedies, or histories. Julius Caesar is technically classified as one of the tragedies. The play is based on real events, though, and could easily be taken for a history by someone who didn't know the definition of a tragedy.
David describes the delight of seeing "those noble Romans alive before me." He is aware at the very least that seeing these events performed involves the fantasy of the characters coming back from the dead. Furthermore, he seems seduced by the fantasy that these are real Romans, not fictionalized characters brought to life by actors. David wants to interpret the play not only as a history, but as a time capsule. This is the same way he engages with his own memories: he has a difficult time remembering that he is not actively reliving them. Sitting in the theater is a kind of moment out of time, when David can feel privy to history and culture. Going back into the "real world" of the street afterwards, on the other hand, is a major letdown for him.
Still, David might be onto something with his feeling that the events of the play are immediate and real. Upon leaving the theater, David is about to run into Steerforth. At this point, he trusts Steerforth as one of his closest childhood friends and mentors. When Steerforth betrays him, like Caesar's friends betrayed him, David will have to learn the difficult lesson of vigilance.
In Chapter 43, David marries Dora. One of the people he remembers being in attendance is an "ancient mariner," which is an allusion to Samuel Taylor Coleridge's poem The Rime of the Ancient Mariner:
Of the clergyman and clerk appearing; of a few boatmen and some other people strolling in; of an ancient mariner behind me, strongly flavoring the church with rum; of the service beginning in a deep voice, and our all being very attentive.
In Coleridge's poem, an ancient mariner pulls a wedding guest aside just before the ceremony to tell him the tale of a harrowing boat journey. The presence of this "ancient mariner" at David and Dora's wedding is not a good omen. In Coleridge's poem, the mariner spends his entire life atoning for a moment when he shot an albatross that kept flying around the boat. The other sailors all believed the slaying of the bird brought bad luck. For a period of time, he was made to wear the albatross around his neck as a symbol of his guilt. Once he returns from his journey, he is cursed to wander forever, telling the tale. It is never completely clear whether he is cursed by supernatural forces or simply by the guilt of killing an innocent creature.
David doesn't think anything of the ancient mariner at the time, but he ought to. David sees Dora as a charmingly child-like woman. She even asks him to call her his child-wife. She is essentially an innocent creature whom David comes to find bothersome. His mistreatment of her parallels not only the mariner's mistreatment of the albatross, but also Mr. Murdstone's mistreatment of his mother. David never becomes quite the abusive husband Mr. Murdstone was, but he very well may have if Dora had not died before they were married long enough for him to turn into a truly terrible husband. David and Dora have already fought about money and about their respective roles in their marriage, so he already knows that he should not be marrying her. The allusion to Coleridge's poem signals that David is going to spend much of his life needing to atone for this lapse in judgment.
In Chapter 61, Mr. Creakle writes to the now-famous David and invites him to visit the prison he now oversees as a magistrate. The prison is an allusion to Jeremy Bentham's panopticon, a model for prisons that boomed during the Victorian era:
[I]t struck me, when we began to visit individuals in their cells, and to traverse the passages in which those cells were, and to have the manner of the going to chapel and so forth, explained to us, that there was a strong probability of the prisoners [...] carrying on a pretty complete system of intercourse. This, at the time I write, has been proved, I believe, to be the case; but, as it would have been flat blasphemy against the system to have hinted such a doubt then, I looked out for the penitence as diligently as I could.
Just before this passage, David has described his tour of the prison. Mr. Creakle has emphasized that the prison was designed for "repentance," and he has pointed out all the features that Victorian readers would have recognized as hallmarks of Jeremy Bentham's popular blueprint for a prison. Bentham, a utilitarian philosopher, believed that moral actions were determined by the greatest good for the most people. He believed that prisons should be a place for penitence, where prisoners reflected on the harm they had caused to society. This way, prisoners could repair their own moral breaches while society (supposedly) avoided causing further harm. Bentham's idea of the "panopticon" was a theory before it was an architecture style. The basic idea was that if prisoners were completely isolated but felt they were always being observed, they would be spurred on to behave well and repent.
As an architecture style, the panopticon consisted of a central guard tower from which all prison cells were supposed to be visible. Prisoners would not be able to see each other. This design was also applied to other institutions, like schools. It is worth noting that Creakle can use the same philosophy as a headmaster and a magistrate. The panopticon and its heavy reliance on surveillance has been criticized (most notably by the French philosopher Michel Foucault) as an ineffective and inhumane system for encouraging positive social behavior. Although these critiques were still in their infancy when Dickens was writing, David notices in this passage that the prison doesn't seem to work like it's supposed to in theory. It is actually quite a social place, where prisoners can be seen "carrying on a pretty complete system of intercourse." The novel does not take up whether or not social activity is bad for those incarcerated. Nonetheless, Dickens uses the novel's retrospective stance to comment on how this popular style of prison didn't do what it claimed to do. Mr. Creakle looks especially foolish for failing to see, from his official surveilling position no less, what is going on right under his nose.