Theory of program design