In connection with code-switching the term domain is usually used to denote the (social) context of interaction. The concept of the sociolinguistic domain goes back to the American sociolinguist Joshua Fishman. Speech communities are made up of a number of domains which organize and define social life. Typical domains in a speech community include family, religion, education, employment, and friendship. Each domain has distinctive, domain-specific factors: addressee, setting, and topic. For example, family members are obviously the main addressees in the family domain, the home location would be the setting and everyday family matters would be the topics. These factors influence code choices within domains in such a way that every domain is associated with a particular code/variety that is thought appropriate for use. In bilingual speech communities, in certain domains one language is used while in other domains the other language is spoken.
Here are a few descriptions of domains of specific language use. They show typical addressees, settings and topics:
In monolingual speech communities situational code-switching is done by speaking varieties of only one language (e.g. the choice between standard and non-standard forms of the language, such as Standard American English and AAVE). A typical linguistic activity in this connection is style shifting in formal and informal speech situations. In multilingual speech communities code-switching takes place between two (or more) separate languages.
Domain-based code switching in multilingual communities should be distinguished from diglossia. The concept of the domain means that one code is regularly used in particular domains (one set of situations) while another code is regularly used in other domains (another set of situations). This phenomenon is similar to diglossia and can also occur in formally non-diglossic multilingual speech communities. However, in diglossic speech communities specialization of function, and thus code switching, between the H-variety and the L-variety is more institutionalized than is the case with 'regular' code-switching.
(Information adapted from Holmes, 2008)
E.g. Holmes, J. An Introduction to Sociolinguistics (3rd ed. 2008). Harlow et al. : Longman, ch. 2.