It also studies how lects differ between groups separated by certain social variables, e.g., ethnicity, religion, economic status, level of education, etc., and how creation and adherence to these rules is used to categorize individuals in social class or socio-economic classes. As the usage of a language varies from place to place (dialect), language usage varies among social classes, and it is these sociolects that sociolinguistics studies.
For example, a sociolinguist might determine through study of social attitudes that Black English Vernacular would not be considered appropriate language use in a business or professional setting; he or she might also study the grammar, phonetics, vocabulary, and other aspects of this sociolect much as a dialectologist would study the same for a regional dialect.
The study of language variation is concerned with social constraints determining language in its contextual environment. Code-switching is the term given to the use of different varieties of language in different social situations.
William Labov is often regarded as the founder of the study of sociolinguistics.
Sociolinguistics differs from sociology of language in that the focus of sociolinguistics is the effect of the society on the language, while the latter's focus is on the language's effect on the society.
See also: Dell Hymes, Deborah Tannen