I never open my front door without seeing who it is first. No matter on what angle you approach the house, lights come on so it's easy to see who it is.
When I do open the door, I stand with most of my body behind the door with just my head poking around it. That way, I have most of my weight there to slam it on their face if I need to.
Sounds like you did the right thing in your situation though, Pat. I have absolutely no idea what I would do if anyone came in my house, but I will try my best to stop that happening in the first place.
My advice? Get a decent sized dog. My dog is much louder than you would think for her size and anyone who comes to the door is a bit weary until they see it's just a giant rat.

(They hesitate = you can react)