Gardeners have been selecting plants that are that little bit better than those their forebears grew since the first farmers sowed a seed. Colonists in 17th century New England were perfectly happy to eat the long, weedy taproots of Queen Anne’s lace (Daucus carota) boiled with wine.

But then someone noticed a plant with a particularly fat root and saved the seed. They had a newer, tastier, more satisfying strain. A few hundred years of that and the tough, hairy, brown taproots of the wild crop became the plump, smooth, orange carrots we know today.

The process of breeding new varieties of edible plants is no longer quite so haphazard. We can’t afford to leave it to chance. As populations grow, our ability to feed ourselves depends on breeders developing more productive varieties of plants as well as those able to fend off diseases by themselves, without dependence on chemical sprays.

Home growers benefit richly from the race to breed the perfect vegetable. As well as boosted productivity and disease resistance, modern varieties offer enhanced flavor, better nutrition, more novel colors or larger fruit. There are varieties that cope with poorer soils and others that thrive in particularly hot or cold climates. Breeding has also brought us strains adapted to the artificial conditions of indoor gardening, such as small-fruited tomatoes, bush belle peppers, dwarf peas in a pot and the mini fairy tale eggplant.

We still rely on selection in plant breeding today, but there have been two leaps forward. In the 19th century, Gregor Mendel’s laws of inheritance brought us hybridization—the deliberate crossing of one variety with another to enhance particular characteristics. And, more recently, genetic technology, including the use of marker genes and genetic engineering, has sped up a process that might otherwise take years.

In classic Mendelian hybridization, using the pollen of one variety deliberately and exclusively to fertilize the flowers of another might produce a corn that crops early, even in colder summers, but falls short on flavor. Cross it with a late-maturing but tasty, super-sweet corn, and with any luck you’ll have a new corn that produces super-sweet cobs early in the season. Backcrossing—re-hybridizing the first-generation offspring with its parent, the early-maturing variety—cements that quality in further generations.

The arrival of genetic engineering has meant plant breeders no longer have to wait several seasons for growing trials to confirm results. The ability to sequence genomes ever more quickly and cheaply has forever changed the face of plant breeding. Most modern plant breeding blends traditional and 21st-century techniques. When they sequence the gene of a plant able to resist a certain pathogen, researchers can see exactly which genetic mutation lets it do that. They then mark that gene so when it turns up in the offspring of a traditional hybridization they know straight away that plant can resist the disease.

You no longer even have to wait until plants grow to maturity. Take a leaf or seed, analyze its DNA and you’ll know what it’s capable of. However, in our attempt to hurry nature up and produce bigger, better crops, we’re running into trouble. One of the best, if unexplained side effects of classical hybridization, is hybrid vigor, or heterosis, meaning the offspring of those two different sweet corn varieties will likely outperform both parent plants.

As long as they are compatible, the more different the genetic makeup of the parents, the greater the hybrid vigor and the sturdier the variety produced. Crossing parents that are too genetically similar, on the other hand, produces inbreeding depression—a weaker, inferior variety.

Repeated inbreeding of high-quality, closely related crops has led to a depletion of genetic diversity, and fewer genes mean fewer strategies to resist new pests and diseases. In the race for heavier yields, genes for flavor or texture are also often left behind, producing increasingly bland, watery strains that may pump out the produce but strains are easily wiped out by disease and are progressively weakened with each generation.

Scientists are going back to those weedy, wild crop relatives for the solution. Queen Anne’s lace, cabbages growing on coastal sand dunes and the small, hard, wild apples of Kazakhstan are still out there and are as genetically diverse as ever.

The law of natural selection demands that a crop without the ability to defend itself against disease will die, so any wild crops still with us today are the toughest, most resilient of the bunch. Plant breeders are now mining this rich seam of genetic material for new, robust varieties. One of the wild forebears of the tomato, for example, is Solanum pimpinellifolium from Ecuador.

Its grape-sized fruits have lent many of their 35,000 genes to the development of the commercial tomato, but after years of pursuing a tomato that’s large, flavorful and uniform, most varieties have retained only a single disease-resistance gene. Breeders are now concentrating on getting some of those infection-beating traits back using S. pimpinellifolium and other wild relatives. They’ve managed to return 40 disease-resistant genes, with more on the way.

The bad news is that diseases fight back. They hybridize just like other natural organisms, and many adapt fast to breeding innovations. So, plants bred with just one genetic defense mechanism effectively lose their resistance over time. For example, the bacterium that causes bacterial spot on peppers—Xanthomonas euvesicatoria—has mutated into 10 different races.

In South Florida before 1989, race 2 was the most common. A pepper genetically resistant to race 2 arrived, but with race 2 taken out, race 1 became virulent. Then, in 1997, a cultivar was found with resistance to races 1, 2 and 3. Race 6 saw its chance and became widespread.

Genetic modification is one answer. The first genetically modified potato resistant to late blight (another disease notoriously quick to mutate) is now being developed using a stack of three resistant genes. This means a disease will effectively have to mutate three ways at once if it’s to get around it. But genetic modification is so controversial it’s likely to be many years before such varieties are widely grown, let alone available to home growers. And like most modern plant breeding, genetic modification still relies on vertical resistance, identifying one gene able to resist one disease and locking breeders into an arms race.

Oftentimes, pathogens mutate faster than breeders can produce new varieties. Breed in as many disease resistant genes as you can, though, and you’re insured against multiple threats. This is horizontal resistance, pioneered by Canadian-British plant scientist Dr. Raoul Robinson. You don’t even need to find a disease-resistant gene first. It’s a scattergun approach—you expose a crop to multiple pathogens and select those that show partial ability to survive. Do this through successive generations and the remaining plants have many resistant genes tolerant of multiple types of diseases.

Unlike vertical resistance, demanding ever more resistant genes to stay ahead of the disease, horizontal resistance is stable and never breaks down. Its founding principle is that mysterious hybrid vigor. The more genetic diversity a plant has, the better equipped it is to resist whatever comes its way. Cornell University, a leader in this research, has now released more than 15 vegetable cultivars bred for horizontal resistance to disease, including winter squash Cornell bush delicata and trailblazer cucumbers.

Horizontal resistance usually only works within its local ecosystem, so a horizontally-resistant strain that performs well in New England won’t do so well in Washington, unlike vertical resistance in which one gene is identified that can protect a crop as well in Korea as in California. But, small-scale home growers don’t care if their crop grows well 1,000 miles away. Horizontal resistance technology works best for low-key, organic agriculture—it’s local and sustainable.

Low-tech horizontal resistance breeding is also a technique available to anyone who grows their own fruit or vegetables. Disease-resistant varieties are invaluable indoors, where there’s often restricted airflow and fungal diseases can take hold fast. So, if your peas are struck down by mildew, collect seed from any plants able to survive the attack. They’ll pass on that ability to shrug off fungal infection to their offspring.

The following year, if all has gone well, you should have an increased number of individuals from your saved seeds that are better able to withstand infection from the mildew spores specific to your environment. Select the sturdiest of these and save the seed again. This is how all heirloom varieties are made, with the gradual improvement from one generation to the next, the seed re-sown in the same environment and the best of each batch saved to pass on their exceptional abilities to next year’s crop.

Your home-grown heirloom is adapted to grow best only in your particular conditions. It will withstand the unique pathogen strains in your environment and you’ll get a tailor-made variety that’s more healthy, vigorous and productive than any other would be in your circumstances. Plus, you’ll have created an heirloom to name yourself—your own small but significant contribution to gardening history.