Allegories are regarded as a literary genre and sometimes as an artistic device use to portray something in a symbolic way.
In literature, is sort of a metaphor where "<em>that something</em>" is used to convey a message with an extensive, deeper or general scope.
They are generally applied with a moral connotation or for political purposes, sometimes carrying a spiritual meaning, or simply related to real world issues.
The story of <em>"Young Goodman Brown"</em> about someone's internal conflict, strong feelings and impulses is an example of allegory as an analogy of the strife between good and evil.