"I am inclined to think that cakes and ale prevail most freely in times that are perilous and when sources of sorrow abound." Anthony Trollope

There's nothing quite like sharing generous slices of mouthwatering homemade cake with family or friends. In making a cake you are taking advantage of some magical scientific transformations to create something sugary, delicate and delicious that everyone will love – and love you for.

Like many people, I was inducted into cake making at the apron of my mother. Some of my most treasured memories are of scooping fairy cake mixture into little paper cases, dipping my fingers into the melted chocolate icing, and the satisfaction of eating the misshapen creations for tea.

Making cakes like these might seem like an ageless tradition, but actually this type of light, airy cake is a relatively new invention.

The first skilled bakers were probably the ancient Egyptians. At this time cakes were basically breads, with egg, fat and honey added to create the recognisable essence of cake: richness and sweetness. The earliest English cakes were still essentially bread, their main distinguishing characteristics being their shape – round and flat – and that they were hard on both sides as a result of being turned during baking.

Cakes as we know them today only came on the scene during the 18th and 19th centuries when the lightness created by the leavening power of yeast was replaced, first by eggs, and then by chemical raising agents such as bicarbonate of soda. Raising agents provided a greater leavening power than yeast with much less time and effort.

A classic of risen cakes is the English pound cake, on which the Victoria sponge is based. These cakes generally contain equal weights of the four major ingredients: structure-building flour and eggs; and structure-weakening fat and sugar. This recipe provides the perfect balance of these ingredients. With any more fat or sugar the delicate scaffold of egg and flour collapses, making a dense, heavy cake (like a fruit cake).

Recipe

250 g (10oz) of self raising flour

250g (10oz) of caster sugar

250g (10oz) of butter (at a cool room temperature) or margarine

Five lightly beaten eggs (assuming each egg weighs about 50g (2oz))

Pinch of salt

Take the sugar and fat and beat together until the mixture reaches a fluffy consistency similar to whipped cream. This can be done either by hand if you are feeling strong, otherwise use an electric whisk.

Much of the tender, melt-in-the-mouth texture of cake comes from gas bubbles, which subdivide the batter into fragile sheets. The majority of this air is added in this initial stage by vigorous mixing of the fat and sugar – a process called "creaming". Air is carried along on the rough surfaces of the sugar crystals. This is why we use caster sugar, as the smaller the crystals, the more air is incorporated. These bubbles of air are encased by a film of fat, creating a foam.

Creaming can be hard work. In 1857 Miss Leslie (an American author of popular cookbooks) described a technique that would allow cooks to beat eggs "for an hour without fatigue" but then advised: "to stir butter and sugar is the hardest part of cake making. Have this done by a manservant."

Take a break from beating and collect some of the mixture on your finger to taste. Notice how the smooth buttery flavour hits your mouth first, and then the sweetness comes in as the gritty sugar dissolves in your saliva. Notice that the mixture is lighter and softer than butter on its own: this is all the air you have incorporated.

Also notice how the fat coats the inside of your mouth. It is this coating ability that allows the fat to play another crucial role, that of a "shortener". The fat coats the starch and protein of the flour with an oily film, and in so doing reduces the formation of tough (bready) gluten. Fruit purees can also take on this role. This leads to a cake that has a tender and "short" crumb.

In factory cake-making, creating a fat that is plastic enough to spread over a large surface area of flour grains but soft enough to form globules requires the application of much science. Companies spend a lot of time mixing blends of various vegetable oils to get the perfect properties. At home, however, the third role of fat for me takes precedence: flavour. That's why I use butter. Although the fluidity isn't carefully controlled it always makes great cakes, and has done for hundreds of years.

As a child, the overriding characteristic of cakes was the sweetness of refined sugar. However, the role of sugar in cake is much more complex. Initially it carries air bubbles into the mixture. It has a tenderising effect, as it softens flour proteins. It also lowers the caramelisation point of the batter, allowing the cake crust to colour at a lower temperature. Finally, it helps to keep the cake moist and edible for several days after baking.

Salt is another vital ingredient as it acts both as a taste enhancer and to strengthen the gluten network.

Beat the eggs into the mixture and then gently fold in the flour, preferably with a metal spoon.

Beaten egg is added to the mixture to stop the fat-coated air bubbles, created by creaming, from collapsing when heated. The egg proteins conveniently form a layer around each air bubble. As the temperature of the cake rises in the heat of the oven this layer coagulates to form a rigid wall around each bubble, preventing it from bursting and ruining the cake's texture.

The eggs also provide the majority of the liquid (water) for the cake mixture. You will know the water provided by the eggs is sufficient – it usually is – if the mixture forms a thin coat on the back of a metal spoon. If it doesn't, add a little water or milk to loosen up the mixture.

Tasting is vital at every step of cake making, and I love tasting this stage, despite the raw eggs. For me the very buttery, sugary taste is the taste of childhood – the treat of cleaning the bowl out with a spoon. It you concentrate you can taste the eggs and flour as gentle background flavours. The flour gives the mixture a slightly pasty texture, which makes it stick to the inside of your mouth.

It was during the 17th century that eggs became the dominant ingredient for raising cakes, gradually replacing yeast. This was before chemical raising agents, so all of the air in the cake had to be added by vigorous beating. One early recipe states that four eggs should be "beaten together for two hours" to lighten a fine biscuit bread. These air bubbles were then trapped during the baking, a little like in a soufflé, to produce a light and fluffy cake.

This all changed with the discovery of chemical leavening agents such as those in self-raising flour. The chemical leavening agent is essentially baking powder: a blend of a dried acid (for example cream of tartar and sodium aluminium sulphate) and an alkali (sodium bicarbonate known commonly as baking soda). Adding water (and heat) to this mixture allows the acid to react with the alkali to produce carbon dioxide gas. This is trapped in the tiny air pockets of the batter that were made when you creamed the fat and sugar.

This means you don't have to add as much air in your mixing because the chemical leavening agent will do some of the work for you. In fact, the quality of modern leaveners and other ingredients (and equipment like the electric whisk) means that mixing all the ingredients together all at once can still produce a light cake. However, I think the traditional method of beating the butter and sugar first is the most satisfying.

Flour takes the role of structure-builder within the cake. The starch in the flour is a reinforcing agent that stiffens and helps strengthen the egg foam. Some of the proteins in the flour join together to create an extensive network of coiled proteins, known as gluten. It is this gluten that holds the cake together. Its elastic nature allows the batter to expand during baking (to incorporate gases) and then it coagulates into a strong network that supports the heavy weight of sugar and shortening.

The gentle folding action used to incorporate the flour avoids breaking the bubbles you have worked so hard to put into the mixture. It also reduces gluten formation because although this is vital to the structure of the cake, excessive beating creates too much gluten, resulting in a cake with a heavy, bready texture. Modern cake flour is made from "soft" wheats with a low protein content, as opposed to bread flour which is "hard" with a high protein content.

Divide the mixture between two greased 20cm cake tins.

I always use my little finger to scrape the excess mixture from the spoon into the tins. My mother used to say that the little finger is the cleanest. While I doubt this, the habit has been passed down to me through her genes. As I pour the mixture into the tins I love to watch its gloopy consistency, its slightly grainy texture and marvel at its rich yellow colour. The beautiful yellow comes from the eggs and from carotene in the butter, the same chemical that makes carrots orange. It originates in the grass on which the cows have grazed.

Place in a pre-heated over at 180C for around 25-30 minutes.

There are few things better than sitting in a kitchen as it fills with the smell of baking. So make a cup of tea and relax for the next 30 minutes, letting the warm smells emanating from the oven envelope you. The smell of warm butter; the slightly sulphury smell of the eggs as they coagulate; the dark caramelising smell of the browning reactions (and, if you get distracted, the acrid smell of burning).

Over time the smells get darker, richer, more caramelised. Baking a cake on a cold, drizzly, miserable day can't help but make you feel better about the world.

Baking can be broken into three stages: expansion, setting and browning. As the batter temperature rises, the gases in the air cells expand the stretchy gluten from the flour, then the chemical leavening agents release carbon dioxide. As the batter reaches 60C, water vapour begins to form and expand the air cells even further. Carbon dioxide and water vapour account for approximately 90% of the subsequent expansion of the batter, the remaining 10% being due to thermal expansion.

At around 80C, the risen batter adopts its permanent shape as the egg proteins coagulate, the starch granules absorb water, swell and form a gel, and the gluten loses its elasticity. The texture produced at this point is then held until the cake is set by the coagulation of the egg and flour proteins, producing the familiar porous structure of the cake crumb.

Finally, flavour-enhancing browning (Maillard) reactions take place on the now dried surface. It is at this point you have to decide whether the cake is ready – one of the most critical points in the whole process. The cake will shrink slightly away from the walls of the tin and the crust will spring back when touched with a finger. Because the batter has coagulated, a wire or thin knife poked into the cake should come back clean.

After removing the cake from the oven, let it stand in the tin for about 10 minutes, then loosen and turn out gently onto a wire rack to cool. Avoid excessive handling while hot.

Something not quite right? If the oven temperature was too low then the batter will have set too slowly, and expanding gas cells will have coagulated to produce a coarse, heavy texture, making the upper surface sink. If the oven was too hot then the outer portions of the batter will have set before the inside has finished expanding, which produces a peaked, volcano-like surface with excessive browning.

While the cake cools, make some of your favourite icing and apply generously. Mine is butter icing – 2:1 icing sugar to butter by weight, beaten together with a little lemon juice or milk.

At last, you can cut a lovely thick slice, sit down with another cup of tea in a comfy chair and enjoy a quiet moment with your beautiful creation. It might not be as good as your mum's but it will taste great and everyone will want a slice.

Dr Andy Connelly is a cookery writer and researcher in glass science at the University of Sheffield