An elegy is a poem of lament for the dead; a eulogy is a speech of praise, often reserved for the recently deceased though death is not a prerequisite.