Laws are like computer programs. Like programs, laws try to apply rules to change their environment but the system for making laws isn't setup to make good laws. Programmers have generally accepted best practices to increase the chance of good code but there aren't such practices for laws (or they are minimal).
- Laws have to deal with much more varied input than computer programs.
- Laws have greater risks when the input isn't handle correctly (people can die)
- Laws are written by people who are selected for their ability to have general goals -- not people who are necessarily good at ensuring that all of the details are correct. Generally visionaries don't write code.
- Laws have virtually no testing that is done before implementation (sometimes there are studies but they are usually general). Code generally has multiple types of testing: compiler, unit, functional, QA, user, etc that verify that the code is good before it is released.
- Laws are written by large groups that are all responsible for large portions. Programmers are usually responsible for small portions that don't overlap much.
- Laws are applied to large groups before being tested on small groups (sometimes federal laws are based on state laws but that is rare and loose).
- All of the people who help produce programs generally focus on a narrow domain but laws are mainly written by generalists (exceptions being lobbyists and "experts")
- Laws reference parts of laws, which is like functions
- Simplicity isn't a goal for laws.
- Laws use the waterfall model
- Laws don't have official comments
What other programming best practices do laws not follow? Are there programming practices that laws follow well?