Harry Potter and the fictional foils, part one: Dudley and Draco
One of the pleasures of reading the Potter books is the integration of the characters--not only with each other, since they tend to fall into social groups (by family, institutional affiliation or simply location) that reinforce their characterizations, so that all Hogwarts students, for instance, share certain characteristics by virtue of that connection, which we should expect--but also by their actions in relation to each other. In considering the books structurally, it would be easy to analyze the qualities of character, and the proximity of any given character to another, as an element of drama or engine of the plot.
If I were in class just now, I would have walked to the board and written HARRY in the center, and drawn a circle around it. From there, I would have arranged Ron, Hermione and, eventually Ginny Weasley nearby (but as a cluster, since they are also closely related to each other), then the Weasley family at a further distance (but still near enough to Ron and Ginny to indicate relationship, and then Dumbledore and the other Hogwarts faculty nearby, but in another direction. Think of it as a Venn diagram, or as a series of overlapping circles--which amounts to much the same thing: characters group themselves together by relation to the action, and by proximity (spatial and emotional) to Harry.
If we map the qualities of the characters this way, by affinity, then we can examine the action of the books as a series of interrelations within and between contiguous circles. Or nearly so. Eventually this diagram would expand outward with each character or circle of associated characters positioned, more or less distantly, but always in relation to Harry, whose centrality on the imaginary blackboard is the emblem of his place as the character through which Rowling tells her stories: using first-person omniscient narration, we see everything only through Harry's eyes, so his presence is always dead-center in the narrative.
All of that said, we can also begin to define characters in terms of their placement in relation to Harry, and it quickly becomes apparent that four or five others--Ronald Weasley, Hermione Grainger, Dudley Dursly and Draco Malfoy, at least--are frequently employed by Rowling to further characterize Harry. That is, whatever other functions they may serve in the narrative, they are Harry's foils.
Voldemort is also a foil, eventually, but his late personal appearance in the story, and his great importance, merit separate consideration.
Beyond them, a chorus of others--Neville Longbottom, Parvati Patel, Professor Trelawney, Hagrid, to name just a few--are characters less directly connected to Harry (at least for the purposes of his characterization; Hagrid, for instance, is a vividly-drawn character who renders little in comparison to Harry, no matter how often or intensely they associate). Characters such as Dumbledore, MacGonnegal and Snape are also fully-rounded (especially Snape, whose contradictions have even inspired an independent, book-length literary study), but exist independently, quite aside from their potential roles as foils.
Not all foils are created equal, however, and two, Dudley Dursley and Draco Malfoy, are perhaps the most obvious, and least revelatory, of the group.
Dudley is, in many ways, the avatar of Dursley Family values: un-self-aware and smugly obsessed with the satisfaction of his personal needs, he is an overfed lout, all id and appetite and belligerence toward Harry. As I've mentioned previously, and like the rest of his family, it is hard to take him seriously as a character beyond his trite role as a foil for Harry. Indeed, he is everything Harry is not: spoiled, demanding, uncurious and unintelligent, and fat. Part of the reason for this is that we see him through Harry's eyes (as we see everything, particularly in the cursory characterizations of the first two books), which device brings with it an implicit judgement--though Dudley is painted so broadly that he is not likely to escape judgement from even the most unsophisticated reader, and Harry is also remarkably silent on the family squalor in which he's been raised--at east at first.
Nevertheless, it's Dudley's obnoxiousness, and not any contrary virtue of Harry's, that damns him in our eyes--though we ought to consider his appearance as an element worthy of specific commentary. The excess poundage of the Dursley household is routinely held up as a symptom of a larger moral failing--to which Harry's physique is an implicit rebuke. This is no small--I meant that--irony when we consider that Dudley Dursley's weight is a constant source of criticism deployed against both himself, personally, and the values of his parents, one of whom is described as having hardly any neck. We can note--and we certainly will, in the future--that Rowling regularly body-shames her characters, attributing ugliness of one kind or another to every single one whose behavior is objectionable (or even, often, simply, irksome) to Harry. Evil is evident in the Potter books-the bad simply look bad. But Dudley is less evil than venal; we are meant to laugh at Dudley, who will surely never shape up.
Even emotionally, Dudley is Harry's opposite: his adolescence is marked by subterfuge against his parents (and yet somehow Harry, who also frequently deceives the adults around him, is not discussed with similar authorial disapproval), and his friends, a gang of neighborhood toughs with whom he exacts petty transgressions against younger and weaker children in the neighborhood, resembles nothing less like Harry's associations with Ron and Hermione than Draco Malfoy's clique of Crab and Goyle.
Draco, on the other hand, while illustrative in similar ways, is directionally different. He is from a wealthy and well-connected family, as Harry is not--and so Harry must earn his status (thus establishing and enriching his identity, and his affective pull on the reader, through his accumulating acumen and exploits, while Draco remains comparatively flat). He is predisposed to be critical, where Harry is, at least at first, all goggle-eyed wonder (a device that allows the reader to take in Hogwarts and the wizarding world with Harry's sense of awe, and to invest imaginatively in a sense of possession--in both senses of that term, as Harry assumes his new place, but is also taken with it). Draco is given to rejecting his best abilities, as he develops, in favor of cruder ones: he relies on social exclusion, bullying and insult as Harry grows as a developing wizard; Malfoy is rarely shown working magic since his true powers lie in negative social interaction and disparagement. His power over Ron, for instance, lies in the truth beneath his sneering comments about the Weasley's comparative poverty, and his attacks on Hermione are based on racist or eugenic claims to superior birth. And as Harry has Ron and Hermione, so Malfoy has Crab and Goyle, a foil's gang of foils whose opacity and brutishness highlight the sensitivity of Harry's circle of friends. Finally, Draco exhibits a utilitarian or realpolitikal indifference to evil. He is suborned by Voldemort into attacking, if not murdering, Dumbledore perhaps because he finds in service to The Dark Lord the most immediate way to restore his family's social position once his father is disgraced and imprisoned as a death-eater in Azkaban.
Harry, by comparison, displays an unusual amount of sangfroid for an abused orphan (we could realistically expect a greater desire to compensate, in his actions toward others, for his loveless upbringing, but of such contradictions are virtuous--and decidedly fictional--heroes made): he is warm, generous, tolerant (though nevertheless quick to judge others when necessary for the convenience of the author--think of his distaste for Professor Trelawney, who is, in her way, a better teacher than Hagrid, whose often dangerous and unstructured lessons are forgiven out of friendship), and loyal. He is so often given to doing and feeling "the right thing" that, when he needs to declare his feelings and stake a moral claim on right behavior--as he does in his conversations with Dumbledore in The Half-Blood Prince--the action seems heavy-handed. When Harry is shocked to learn that his father had abused and bullied Snape in their youth, Harry is disappointed, but we almost never see him use his powers against those who torment him in petty ways, and he has a stubborn tendency to fail to learn from his mistakes, if only because he makes so few. If he's a little too good, well then, so are many heroes in children's literature--and he is surrounded by great evil.