Best defense is not putting yourself in a dangerous position in the first place. Night time, "shortcuts", abandoned areas are all areas used by criminals to take advantage of you.
Anything you do that takes your attention away from the here and now, can make you a victim and cost you your life. Cell phones, iPods, Walkman, book, newspaper or anything that takes your attention away from your immediate surroundings and those people around you are deadly.
Keep your attention on anyone watching or following you. Learn to use reflective surfaces (car glass, glass storefronts, polished steel or chrome) to watch behind you. If you feel you're being followed, either stop where there are people (in a store or restaurant) or turn towards populated areas.
If all else fails and you find yourself being attacked, do not shut down and do not quit fighting. Scratch, hit, pull hair, use keys on vital areas - all these collect DNA for LEO investigation. Use anything available - sticks, bricks, rocks, knives, knitting needles, purse, backpack and strike frequently and aggressively. Scream for help and report incident to police as soon as possible after the attack.
Many people get attacked, but criminals are usually hunting for those who they can get an immediate advantage on, which are usually not paying any attention to their immediate surroundings. If you watch people in a mall or grocery store with the idea of following them and stealing something, your mind will quickly be able to choose the weakest of the pack. By training your mind in the ways of a criminal, you'll be far less likely to be the target of one.
“Malo periculosam, libertatem quam quietam servitutem." (I prefer the tumult of liberty to the quiet of servitude.). Thomas Jefferson
"All that is necessary for the triumph of evil is that good men do nothing."
-Edmund Burke, Loosely translated from Thoughts on the Cause of Present Discontents. (1770)