The Criminal Code of Canada, in combination with other pieces of legislation, including the Youth Criminal Justice Act, the Corrections and Conditional Release Act, and the Canadian Charter of Rights and Freedoms, provides the foundation within which the criminal justice system operates.
Judges do not write laws, laws are written by our elected lawmakers, our Members of Parliament, and are passed by both Parliament and the appointed Senate. Judges do however interpret our laws and provide clarification and specific application where the law is vague or unclear. Judges rely largely on precedents when acting in this respect. Precedents and even the laws themselves are judged by the highest laws contained in the Constitution. The government is limited in its law making ability only by these Constitutional laws. It is possible for new laws or even existing laws to be found to be illegal by the courts. For this reason, parliament must ensure all laws stand up to the constitutional test.
On the other hand it is the responsibility of our MP’s as elected representatives to ensure that the laws they write are sufficiently clear. Where a law is not clear the courts are forced to interpret the law in their own way. This practice is called judicial policy making and is a controversial practice as judges are not elected representatives.