Two halves of the same coin. Programming something is 'teaching' a computer to do it. Except a computer is in many ways the dumbest student possible; you have to spell everything out for it.
In other ways it's also the smartest student possible: It never forgets or misunderstands what you tell it (unless you instruct it to forget something, or you don't say what you actually mean.)