Although Hammurabi often gets credit for the “first” law code, the title should actually go to another, earlier king. An otherwise obscure Sumerian king called Ur-Nammu wrote the first known law code 300 years earlier. Unfortunately for Ur-Nammu’s reputation, much of his code is unreadable, and it has survived only in fragments. Hammurabi’s code is complete. Poor Ur-Nammu remains obscure, while every schoolchild knows the name Hammurabi.