I think our legal system likely would not work better if our punishments resembled the Code of Hammurabi, or we would have stuck with that code. The Code of Hammurabi was the basis of many legal systems around the world for centuries, but we changed to modern systems for a reason.
There are some things modern legal codes share with the Code of Hammurabi. One is clearly delineated laws formally spelled out in writing. That was probably the Code of Hammurabi's central innovation; instead of rules being vague social norms people more or less learned by assimilation, Hammurabi's rules were explicit, codified laws that were written down and couldn't be argued with. It established a system of land ownership and taxation not too different from what we use now.
Many aspects of Hammurabi's code are appalling today. For one, the Code explicitly defines people into upper, middle, and lower classes, and explicitly grants more legal rights to the upper class. The Code includes a number of regulations on slavery, meaning slavery was allowed and considered a legitimate institution. It grants extreme power to the king (who wrote it, after all)—essentially the authority to override any rule or property right at will.
The only part I can see anyone really wanting to go back to today is the criminal justice system, specifically its very harsh punishments which are specifically tailored to the crime. It is what we call a lex talionis, a law of retaliation, under which the way things work is that if someone does something to you, you can do it back to them. If someone punches you, you can punch that person back. If someone pokes out your eye, you poke out that person's eye.
This didn't really work for more abstract crimes like fraud; if he defrauds you, can you really defraud him? Instead, the Code prescribed physical punishments for non-physical crimes. Theft and fraud resulted in your hand being cut off (something still done on occasion in Saudi Arabia). Indeed, a great many crimes were assigned the death penalty, ranging from kidnapping and murder to trespassing and selling unlicensed alcohol.
What would happen if we did this today? Revolution. Violent revolution is essentially the only logical result of such a legal system. Historically, that is ultimately what happened, although Hammurabi conquering a whole bunch of neighboring countries clearly contributed to that.
Why? Because almost everyone breaks some laws on occasion—often for fairly low-risk crimes such as parking improperly, speeding, and jaywalking. If the penalty for all crimes was death, then once you've committed a small crime, what's your incentive not to commit a larger one? If you're going to be executed for jaywalking, why not go ahead and aim for treason, since the punishment is no worse? Treason at least offers the potential for an escape: If you overthrow the government, the government can't enforce its rules on you. Since everyone breaks some laws, the revolution will have a huge amount of popular support.
Modern legal systems are lenient on purpose, because they retain their legitimacy by making punishments feel fair even to most of the people being punished. A $50 parking ticket is annoying, but if you did really park illegally you can't really argue with it, and the legitimacy of the fine or the government executing it is not really in question. If parking in a fire lane carried a sentence of hanging instead, everyone who has ever parked in a fire lane would rise up against the government, because we'd have little to lose and no real other way to try to survive.
There's a proverb about this, usually told as a Chinese general:
"General, we are late for the rendezvous with the Emperor!"
"What is the penalty for tardiness before the Emperor, Lieutenant?"
"I see. And what is the penalty for revolution, Lieutenant?"
"Also death, sir."
"I see. Revolution it is, then. We march on the palace at dawn."