Theory of scaling