The study of systematic ways of transforming a program into another program that has some desirable property and is equivalent to the original program (or, if not equivalent, is related to the original).
Often the aim of such transformation is to produce a more efficient program. It is widely felt that much of the complexity of programming results from the need to produce efficient programs, and that it is therefore desirable to begin with a simple (yet inefficient) program and then transform it to an efficient (but complicated) one. Such transformations may be carried out by hand, by machine, or by both.
Other aims of transformation include expressing certain language constructs in terms of others (transformational semantics). Also, developing algorithms by transformation can serve to verify their correctness, to elucidate their structure, and to provide better understanding of the possible algorithms. See also refinement.