One of London's free newspapers used to contain a column, under the come-hither heading "Lovestruck: Change Your Fate", in which commuters could record their romantic near misses. Part valentine and part message in a bottle, each of these little confessions allowed the writer to speak up without fear of public rejection, and the result was a welling-up of fantasies usually hidden behind the sports pages. "You were on the 8.35 from Balham to Victoria on Tuesday wearing glasses with a scar above your eye. Drink?" enquires Blonde in Green Dress. "To the lady sitting on the 18.05 from Victoria to Lewes, I think I may be falling in love with you," confesses Man Opposite. Rarely has the line between talking and stalking been so delicately smudged.
As in other attempts to restore the genteel eroticism of Brief Encounter to modern public transport, it is fitting that most of the scenarios involve a train. This might reflect a more general temptation to use the blank expressions of strangers as screens on to which private dreams can be projected, but it also reflects a common resistance to the idea that our lives trundle along a set of tracks as predictably as the 18.05 from Victoria. To confess that you might be falling in love with a fellow passenger opens up an alternative future, a shiny new timeline, into which your imagination can be shunted for a few moments.
The roads not taken, the parallel worlds in which things happened otherwise - such thoughts are not restricted to a particular genre. They are as integral to the optimistic melodrama of It's a Wonderful Life as they are to the tragic realisation of Marlon Brando's washed-up boxer in On the Waterfront that "I could have been a contender. I could have been somebody." Nor are they unfamiliar in literature.
“Mugby Junction", a Christmas story that Charles Dickens published in December 1866, opens with a traveller passing through an imaginary railway station. A "shadowy train" goes by him in the gloom and it rapidly becomes clear that this is an image of his life. The survivor of an unhappy childhood, who is later "coupled to" a miserable career, he drags his past behind him like a set of grimy freight wagons. As the story develops, Dickens's hero comes to realise that even the longest train is not doomed to travel in the same direction for ever. Gazing at the junction from above, he observes the "wonderful ways" in which the railway lines cross and curve among one another, or veer off unexpectedly, or double back on themselves. By accepting that human life works in a similar way, he discovers that he is free to travel in any number of directions. The "gentleman for Nowhere", as he is known around the station, becomes the gentleman for everywhere.
Such uncertainty has rarely been acknowledged by biographers. Most lives are full of clutter and confusion; every day brings a lesson in how easily planning can be mastered by contingency. Biography, on the other hand, usually seems less concerned with reflecting a subject's life than with redeeming its inadequacies. It tidies up the shapeless business of living into a story with a beginning, middle and end; it removes background hiss and crackle until a single tune can be traced across the years.
While a biography might acknowledge occasional detours from the main narrative - here a failed love affair, there an abandoned draft – most sentences are arrows that fly straight and true until they hit the full stop with a satisfying thwack. There is little room for the kinds of repetition, hesitation or deviation that Radio 4's Just a Minute bans but that most real lives specialise in.
Dickens was aware of the temptation to view life in this way - on one occasion, he sympathetically observed an inmate of a lunatic asylum in Lancaster as he stared at a piece of matting, trying to find a pattern in its fibres - but it hardly reflects the course of his own career. Like the hero of Dombey and Son, he remained obsessed by "what might have been and what was not" and his fiction teems with characters who are granted the power to change their lives, like that seasonal regenerate Scrooge, or who discover that they have badly misunderstood the kind of story they are in.
Dickens's interest in lives that are stymied or knocked off course was more than theoretical. It was personal. The story of how he was sent to labour in a blacking factory as a child has often been told, but it is hard to overstate its importance to Dickens, for whom the tedium of the work was far less significant than his sense that every one of his ambitions was being slowly "crushed in my breast". "My rescue from this kind of existence," he recalled, "I considered quite hopeless and abandoned as such." The echo of Dante - "Abandon all hope, ye who enter here" - suggests that, for the young Dickens, slapping labels on to bottles of shoe polish was as bad as a tortured soul endlessly gurgling mud or being dunked in pitch.
In the end, his parents weakened, or their finances strengthened, and he was allowed to return to school. It was the first step in what has usually been seen as the triumphant progress of his career. Yet Dickens never forgot how vulnerable his life had been - and, as a freelance writer, to some extent still was. The lasting result was his fiction, which allowed him to release - under strict supervision - dozens of alternative lives on to the page: all the damaged children, lonely clerks and other surrogate selves that would otherwise have remained bottled up in his imagination.
The best-known example is David Copperfield, whose initials reflect Dickens's in reverse, like somebody looking into a mirror, and who, over the course of the novel, encounters a mad second-hand clothes dealer named Charley, an ineffectual flute-playing schoolteacher, also named Charley, and Mr Dick, who is writing a "memorial" of Charles I. Similarly, A Tale of Two Cities revolves around physical doubles whom Dickens originally wanted to call Charles Darnay and Dick Carton, so that even their initials would reflect each other.
Soon after I decided to write a new biography of Dickens, it became clear that it was his early fiction that explored these alternative lives most urgently. That is partly because his first stories were chronologically closest to his childhood, meaning that it loomed proportionately larger in his thinking, but it is also because the period in which they were written was equally uncertain about where it was heading. With the first Reform Bill, the accession of Victoria and technological change in everything from transport to computers, the 1830s were a time when the future seemed to be a blank sheet waiting to be written upon.
Dickens's works were equally committed to putting the past in its place, as when Oliver Twist drifts away from his delicate pauper friend Dick and joins a gang of London pickpockets that features a young joker named Charley. Yet the author's past continued to trail him like a shadow. Of all the places in London he could have chosen for the gang's home, Dickens selected "a house near Field-lane", right at the heart of the stinking slum that was on the doorstep of his new home in Bloomsbury. Oliver ascending "the dark and broken stairs" of Fagin's lair was like a distorted reflection of Dickens climbing up to his first-floor study, from where he could look out over the rooftops and catch an occasional whiff of a world he had escaped. So far.
The ending of Oliver Twist is much more reassuring. Oliver is welcomed into his adoptive family and the original final illustration showed him nestled happily in a middle-class living room. It was a model of what would later happen to everything that Dickens wrote. Realising that this was a tipping point in his career, he travelled down to London on one of the new railway lines to alter the title page. After several years of publishing sketches and serialised fiction, he was no longer prepared to shuffle off responsibility on to his comic pseudonym Boz.
With "Oliver Twist, by Charles Dickens", he had arrived as a novelist. Yet that didn't stop him thinking of his career as a work in progress. Every sentence was a way of reaching into the unknown; every page was a miniature Mugby Junction - a place "of many branches, invisible as well as visible, and joined . . . to an endless number of byways".
Robert Douglas-Fairhurst is the author of “Becoming Dickens: the Invention of a Novelist" (Harvard University Press, £20)