According to the legend, the Spartan law was written by the great lawmaker (Greek : νομοθέτης, nomothetis) Lycurgus. Plutarch mentions that Lycurgus (literally "wolf-worker") wrote the laws in order to make the city state of Sparta invincible, the Spartans fearless and law-abiding. It was a law-package with politico-military, economic and social reforms. Although many historians dispute that Lycurgus ever actually existed as a human being, at Sparta he was worshiped as a demigod.
When a boy child was born, the city-state of Sparta gave him a piece of land (Greek: κλήρος, kliros) thus making him a full citizen of Sparta. The father had the right to raise him and teach him the basics until the age of 7. The boy would then be educated communally, centrally under state-controlled supervision. The boy would call a military training camp his home until he turns 30. He then could sleep at his own house, with his wife and children.
The boys were trained hard, learning to speak wisely using only a few words (Greek: λακωνισμός, lakonismos), learning to eat just enough to survive, and training hard in order to become useful member of the phalanx. For the Spartan, the fellow soldier at the phalanx was his family. The phalanx unit stayed together until death. He would occasionally be a part of Spartan festivities, he chose his wife and had children, but his real family was his phalanx.
The Spartan boy, learned only the basics, according to Plutarch, such as music and mathematics. Their principal training is a military one, often even crossing moral boundaries, such as learning how to steal without getting caught. The philosophy was that, in case of a war, a soldier might have to steal food in order to survive. The main key point here is that, when a boy was caught, he was not punished for his act of stealing, but for being caught! The Spartan youth had their favorite "game" of stealing food or other possessions from servants (Greek: είλωτες, helotes).
A well-known story that proves the Spartan training and loyalty is this: Once, a 13 year old Spartan boy stole a fox from a village near his camp. Alas, a trainer found him and asked him what he was doing off campus. The boy had seen the trainer and had hidden the fox beneath his cloth. As the boy said nothing, the trainer insisted. The fox, still alive, beneath the boy's cloth, started scratching him, in order to escape. While doing that, the boy continued to deny the stealing until the wounds suffered by the fox killed him.
The apogee of one's training was to comprehend the laws and to be a vital member of the Apella, the Spartans citizens body. It was perhaps the only democratic point of Sparta in its military system. All Spartans became equal voting members of Apella when reached the age of 30, voting by shouting rather than balloting.