Euh locks on doors don't stop burglars. They stop kids from doing petty vandalism. Burglars can easily pick your door locks, or will simply break a window to enter.
Door locks are the equivalent of FTP server banner messages telling people "access is restricted to those authorized".
What prevents burglaries in civilized countries is the social contract, and the fact that most people have a common moral and ethical sense that tells them it's wrong. The idea that you're better off working for a decent salary and that you should respect the property of others so they'll respect you is a basic logic that holds true in many places (less so nowadays in some countries where the working poor are worse every day).
The reason it doesn't work on the Internet is because this contract falls apart because of distance and the anonymizing nature of the Internet. Not just the fact that bad guys can be pseudonymous, but because to them you're not a person, you're an IP address. It de-humanizes contact and makes it easier to justify bad behavior.
Add to it the fact that there may be a small portion of people in a city or neighborhood who are lacking enough in morality to do burglaries, but in the whole world there's a lot more of them. And although they can't all break into your house, they can all break into your computer...