This brings up an interesting point about what exactly the law is and how everyone's supposed to be aware of it.

It's 2014. Why can't officers carry a tablet that stores the entirety of the law, and show you exactly to the letter which law you're violating? Likewise, every citizen should have trivial access to the extant laws, with notes explaining them in a way that's comprehensible to anyone with a high school education.

If ignorance of the law isn't a valid excuse for breaking it, everyone should have simple access to it.

The law isn't just what's on the statute book, it has to be read in the context of case law (at least in jurisdictions that use a common law system), which evolves over time and can vary based on the individual facts of the case.

That said, things like that do exist - the UK's entire statute book (well, almost) is available online,[0] free of charge and via a RESFTful API in machine-readable formats.[1]

Likewise, the German federal government publishes the law in XML, and there's even a markdown representation available on github.[2]

[0] http://legisltion.gov.uk/

[1] http://www.legislation.gov.uk/developer/formats

[2] https://github.com/bundestag/gesetze