Certain nematodes can be eliminated from a site by growing a thick crop of marigolds for one season prior to planting the vegetable or fruit crop, or by interplanting marigolds between crop rows. Destructive insects often locate their food by smell. Many plants, especially culinary herbs, produce strong scents which may confuse insect pests looking for a host to feed on. Garden vegetable plants such as garlic, onions, chives, and herbs such as catnip, horehound, wormwood, basil, tansy, and mints all produce scents which seem to repel insects or mask the scents which attract insects. A certain level of insect protection can be achieved by carefully interplanting some of these as companions to vegetables.
Many insect pests have specific food preferences while others feed on a wide assortment of hosts.
Even those species which feed on a wide variety of hosts, such as Japanese beetles, have preferences for certain plants. It is possible to plant a preferred host as a trap crop near the plant that is being protected. Many insects are helpful because they eat or parasitize harmful insects. Most species of wasps and spiders are beneficial as are ground beetles, praying mantids, lady bugs, pirate bugs, and several species of flies. It is possible to attract beneficial insects by planting flowers near the garden.