We discuss, in terms of rate-distortion theory, the fitness of molecular codes as the problem of designing an optimal information channel. The fitness is governed by an interplay between the cost and quality of the channel, which induces smoothness in the code. By incorporating this code fitness into population dynamics models, we suggest that the emergence and evolution of molecular codes may be explained by simple channel design considerations.