The Importance of Being Earnest, by Oscar Wilde, is indeed a play that has been written with a purpose. First, it is a representative of the genre of plays that treats topics as a comedy of manners. This genre explores and mocks the behaviors and mannerisms of different social classes in order to produce a comical result.
However, it is not just satire for satire's sake. It is also a reality check for the upper classes, so that they can see in the plays a mirror of how the majority of the population thinks of them. The hypocritical snobbery, their affectation of voice and poise, their "holier than thou" attitudes, and their elitism made them an easy target for jokes by the likes of Austen, Wilde, Dickens, Shaw, and many more literary greats. This is also a window into the mentality of the social classes, and of how they treated each other as community members.
Just from this play alone we can see that there was a marked difference among individuals as far as class, rank, peerage, family name, family history, income, place of residence, and expectations. These differences led no doubt to dissension and resentment among social classes. This is hardly a characteristic of a strong and stable society.
Hence, The Importance of Being Earnest opens a window into the lives of typical Victorians, and shows us their idiosyncrasies, systems of belief, behaviors, mannerisms, and expectations for themselves an others. This gives us a great profile and background information that may help us understand the reason why some characters were created the way that they were.