Molecular population genetic studies are providing new perspectives on the evolution of genes that confer resistance to pathogens and herbivores. Here, we compare the evolutionary history of different components of the defense response (detection, signaling and response) and of genes with parallel function in plants and Drosophila. A review of the literature indicates that the dominant form of selection acting on defense genes (balancing, positive and purifying) differs among components of defense. Sampling of particular classes of genes and genes from non-model organisms, however, remains limited. Future studies combining molecular evolutionary analyses with ecological genetic and functional analyses should better reveal how natural selection has shaped defense gene evolution.