Thomas Hardy was a British novelist and poet writing during the late nineteenth and early twentieth century. He's primarily remembered for his novels, like
Tess of the D'Urbervilles and
Jude the Obscure, but he started and ended his writing career as a poet. In fact, the scathing reviews in response to
Jude the Obscure in 1895 drove him to give up writing novels altogether – after that, he switched back to poetry and never wrote another novel, though he lived until 1928.
"Afterwards" was published as the grand finale in a volume of poems entitled
Moments of Vision, which came out in 1917. The poem was written towards the end of Hardy's life, and it reflects the bittersweet (more bitter than sweet) nostalgia of an old man looking back over his life and realizing that he's got fewer days ahead than he has behind. It was also written during
World War I, and reflects some of the despair and anguish typical of British literature written during that time – no one had ever seen death or destruction on that scale before. So if "Afterwards" seems kind of dark or depressing to you, you're not alone: Hardy certainly felt that he had plenty to be depressed about.