Many countries (notably those based on English + Roman law, but even Iranian, Lebanese etc) have three or more branches of government; typically: Executive, Legislature, and Judiciary. Good model but start to break down if the branches try to undermine each other, as has been a chronic feature in US politics for the last coupe of decades. I don't think 'code is law' will fix this... It would almost certainly lead to the end of human freedom.