Although flies are invaluable, they do get a dreadful press. Think fly and you’ll see a buzzing black cloud tormenting your hapless head. Or a ruined carrot or wilted cabbage plant.

We often call lots of insects flies when, technically, they’re not. To qualify as a fly, it must be a member of the order Diptera, so needs to have two wings, not four, like the leaf-stripping gooseberry sawfly, the destructive cabbage white butterfly or the gorgeous dragonfly.

In true flies, the second pair of wings have developed into halteres. These are short,

club-shaped organs which the owners use to sense movement, and this lets them perform

high-speed aerial acrobatics and escape the rolled up newspaper.

Flies are often at what we consider their most destructive stage when larvae.

They will spend weeks building up the resources to pupate and, as adults simply mate, lay their eggs and peg out. Like blister aphid, carrot and cabbage rootflies, they are well sheltered as they grow.

Leaf miner larvae, like celery fly (Euleia heraclei) and beet leaf miner (Pegomya hyoscyams), work the same way. But it’s not all bad news.

Other larvae, though clearly not enough, feed on molluscs, and some, like many hoverfly larvae, hoover up aphids by the trillion.

And that’s the point. This column is not a catalogue of woes. Flies play a vital role in a garden’s ecosystem. Although some drive gardeners to distraction, they are an invaluable food source at every stage, from egg to adult.

Many ground-feeding birds, such as thrushes, work over the soil for eggs, tits track down sawfly larvae and migrants such as swallows, chiffchaffs and, of course, flycatchers scoop up adults.

But their most obvious job is pollination. Flies were probably the first pollinators of flowering plants, before bees had evolved. Although some flies, such as clegs, have piercing mouthpieces, many others have sponge-like ones that lap up liquid such as nectar.

So when you look at the open flower head of coriander or feverfew, you’ll probably see lots of small flies crawling around. Some species roam widely so they could spread pollen extensively. In experiments, house flies have been found 10km away from where they had originally been tagged.

This is chickenfeed compared with hoverflies, the second most important pollinating insect group, after bees.

These flies look almost like small wasps and males, in particular, can often be seen hovering in front of flowers, defending their territory.

At the end of the season, they migrate, as do some birds and butterflies. Last month, Karl Wotton of Exeter University reported on a trial he and colleagues had conducted on hoverflies.

Experiments showed that up to 4million hoverflies emigrated every autumn.

The flies return the following spring, pollinate billions of flowers, with larvae consuming up to 10trillion aphids, before pupating and the final generation sets off on an odyssey, flying at altitudes of 150m to 1km. Interestingly, the researchers found we are a net exporter of hoverflies.

We often overlook another major service flies perform for us. They recycle and reuse everything that has died: plants, animals and, of course, our

by-products.

As entomologist Erica McAlister has observed: “If it weren’t for them we would be knee-high in faeces. So thank you, flies, for the important but revolting task you perform.”

Unlike many adult fly species, larvae have mouth parts that let them chew.

So in our compost heaps and garden soil, larvae chew decaying vegetable material into smaller parts, rupturing cell walls and releasing rich organic contents that are food not only for fly larvae but for a host of other organisms, which may also be eaten by the larvae.

Plant of the week

Leucanthemum x superbum ‘Banana Cream’ flowers prolifically all summer: the lemon yellow ray florets fade to ivory as they age giving a gradation of colour. The plant grows 35-50cm tall and has dark green basal leaves.