Pain is an “unpleasant sensation” in response to actual or perceived injury. It is generally assumed that the purposes of pain are twin—to stop the person from engaging in a behavior that is causing the pain, say continuing to dip hand in boiling water, albeit not water that is being slowly brought to boil, and to “train” (in the Pavlovian sense) the body to not engage in such behavior in the future. Given the purpose, the pain response is poorly implemented in many ways. It also sheds light on how the body is architected.
Think of a system that is coded to send a message to the controller to “alert” it to damage and to ask it to reconsider engaging in activity that is causing the damage (or independently take pre hard-coded action). One envisions that the message is sent in a manner that “makes” the controller pay attention, if such attention is warranted, and efficiently conveys a summary of what is going wrong and to what degree, and what particular action that the user is taking that is causing that to happen. One also imagines an “acknowledge” button that the controller presses to assume the responsibility for further action. Then using this information, controller, depending on the circumstance, takes action, and updates the memory and circuiting, if warranted, to create an appropriate aversion for certain activities.
Such signaling is implemented very differently in our body. Firstly it is implemented as “pain.” Next, pain is not proportional to the extent of the injury. This sometimes creates “irrational” aversion. More bizarrely, some harmful things are pleasant, while some good things are painful. Thirdly, there is no direct way for the brain to acknowledge the signal, assume the responsibility of action, and shut off the pain. Next, and worryingly, depending on the extent to which our brain is distracted (say watching television), pain’s intensity varies (This last point has been exploited to build “treatments” for pain). Lastly, our brains can’t temporarily order the signals shut.