Pain is an unpleasant sensation. It is generally assumed that pain has two purposes: 1. to stop us from engaging in a behavior that is causing the pain, say, continuing to dip the hand in boiling water, and 2. to train the body to not engage in such behavior in the future. Given the purpose, pain seems to be poorly implemented.
Think of a system that is coded to send a message to the controller to alert it to the damage and to ask it to reconsider engaging in an activity that is causing the damage (or independently take some 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, the controller, depending on the circumstance, takes some 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 responsibility for 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.