Top, tail and string the beans and chop them into short lengths, more or less following the swell of each bean.
Tie the parsley, bay leaf and thyme into a little bunch.
Heat the oil in a large pan. Put in the onion and garlic and fry for a moment without colouring. Add the beans, the bunch of herbs, the ham ( if using), sherry or wine and water.
Bring to the boil, reduce the heat then cover and stew gently for 1- 1 1/2 hours, checking and adding more water if needed. When the beans are tender add salt, pepper and a little sugar.
Increase the heat and continue to cook, uncovered, to evaporate all but a rich slick of oily juice. Remove the herbs then stir in the breadcrumbs, herbs and lemon.
Top each portion with a quartered hard boiled egg if serving as a main course.