Scales are functions that map a domain to a range. I know I keep saying that, but there really isn't much more to say.
The reason we use them is to avoid math. This makes our code shorter, easier to understand, and more robust, as mistakes in high-school mathematics are some of the hardest bugs to track down.
If you haven't spent 4 years just listening to mathematics at school, note that a function's domain includes the values for which it is defined (the input), and its range includes the values it returns.
The following figure is borrowed from Wikipedia:
Here, X is the domain, Y is the range, and the arrows are the functions. We need a bunch ...