The apple maggot (Rhagoletis pomonella), also known as railroad worm, is a pest of several fruits, mainly apples. The adult form of this insect is about 5 mm (0.2 inch) long, slightly smaller than a house fly, with a white dot on its thorax and a characteristic black banding shaped like an "F" on its wings. The larva, which is the stage of this insect's life cycle that causes the actual damage to the fruit, is similar to a typical fly larva or maggot. Other "worms," especially the larvae of the codling moth, that infest the insides of apples are often confused with the apple maggot. Generally speaking, however caterpillars often feed in the apple’s core while apple maggots feed on the fruit flesh. In infested fruit, the larvae are often difficult to detect due to their pale, cream colour and small body size. The maggot stage has many enemies, including several braconid wasps: Utetes canaliculatus, Diachasmimorpha mellea, and Diachasma alloeum.
The adult stage lays its eggs inside the fruit; before the arrival of apples from Europe, it was found mainly in hawthorns. The young "worm" that hatches consumes the fruit (rarely will the larva leave the fruit while it is still hanging on the tree), and causes it to bruise and decay and finally drop before ripening. The insect overwinters as a pupa in the soil. It only emerges after metamorphosis into a relatively defenseless fly. It uses batesian mimicry as a method of defense - its coloration resembles that of the forelegs and pedipalps of a jumping spider (family Salticidae). Adults emerge from late June through September, with their peak flight occurring in August.
Rhagoletis pomonella is significant evolutionarily in that the race of this species that feeds on apples spontaneously emerged from the hawthorn feeding race in the 1800 - 1850 CE time frame after apples were introduced into North America. The apple feeding race does not now normally feed on hawthorns and the hawthorn feeding race does not now normally feed on apples. This constitutes a possible example of an early step towards the emergence of a new species, a case of sympatric speciation.
The emergence of the apple race of Rhagoletis pomonella also appears to have driven formation of new races among its parasites.
Notes and references 
- Ricklefs, Robert E. and Gary L. Miller (2000). Ecology. W.H. Freeman and Company.
- Feder, J. L. (1998) The apple maggot fly, Rhagoletis pomonella: flies in the face of conventional wisdom about speciation? In Howard, D. J. & Berlocher, S. H. (Eds.) Endless Forms: Species and Speciation. New York, Oxford University Press.
- Forbes, A.A., L.L. Stelinski, T.H.Q. Powell, J.J. Smith and J.L. Feder. 2009. Sequential sympatric speciation across trophic levels. Science 323: 776-779.