DELAPARRA
Index
Color
NL
Category: Programming paradigms

Domain

Explained by Updated

What is Domain?

Domain: The set of possible values a variable can take, e.g. an integer between 1 and 100. In constraint programming, a domain is the set of values a variable is allowed to take. A shift variable might have the domain of every day of the week, and an age variable the integers from 18 to 67.

Definition source Coders Lingo, CC BY 4.0

Frequently asked questions about Domain

How is Domain used in practice?

The solver works by shrinking domains. Each constraint removes values that cannot be part of a valid solution. When a domain becomes empty, that path is impossible, and when every domain has one value left, you have a solution.

What should you keep in mind with Domain?

Thinking in domains is useful outside solvers too. When you design a database column or a form field, ask what the full set of allowed values is. Encoding that with an enum, a check constraint or validation rules catches invalid data early, instead of letting it cause strange behaviour later.

At a glance

CategoryProgramming paradigms
Explained by
Updated

More Programming paradigms terms

All terms starting with D

Skills

Download all skills (zip)

Manuals

Related services

Need any help?

Stuck on one of these in your own project? Tell me what you are working on and I will tell you how I would approach it.