Pair programming is an engineering practice of Extreme Programming Rules. In this case, two programmers work on the same system on the same design or algorithm.
One programmer act as a Driver and other as an Observer who continuously monitors the progress of a project to identify problems. The roles can be reversed at any point of time without any prior intimation.