A moral code is a set of universal, rationally discovered, reality-based principles that one must apply to the particular concretes of one’s everyday life if one wishes to live.
Why does a human being need a moral code? Individuals need such knowledge as survival for human beings, unlike the other animals, is not automatic.
Unlike other organisms — bacteria, elephants or apes which act by instinct — humans beings have no automatic knowledge and must discover the principles needed to survive. Human beings have no “instincts” on how to grow food for nourishment, to drive a car or airplane for transport, build a house for shelter, cure an infection to restore health or interact with one’s fellow human beings in a division of labor economy. Such knowledge must be discovered and learned.
It is the task of morality — the “science of self-preservation” and human fulfillment — to objectively identify and validate that code. Such a moral code defines the virtues (rationality, productivity, integrity, justice, honesty, pride, etc.) one must engage in to achieve the values (creative work, good friends, healthy food, a place to call home, knowledge, rewarding relationships, medicine, self-esteem, etc.) one needs to live as a human being.
Every human being follows some kind of moral code — whether they are fully conscious of it or not.
Their only choice is whether it is irrational or rational, logically consistent or contradictory, based on life in some imaginary existence or on life on earth. Their choices will determine their destiny and happiness on earth, or in the words of John Galt, the hero in Ayn Rand’s revolutionary novel Atlas Shrugged:
“The purpose of morality is to teach you, not to suffer and die, but to enjoy yourself and live.”
What morality teaches a human being how not to suffer and die, but to enjoy themselves and live? The moral code of rational self-interest (rational-egoism).