Upon becoming a shinobi, one must abide by specific rules when out in the field. Ninjas follow this code in order to "kill their emotions," preventing them from running wild and causing the mission to fail. The most important thing for a shinobi is to be a tool for achieving their village and country's goals. Emotions are considered unnecessary things.
These rules are taught to young ninja when they enrol in the Academy.