Theory of coding