Not to justify the actions of the shooter, but ringing the doorbell before breaking in is definitely a thing. It’s a means of checking if the house is occupied - if you’re just trying to steal things, an unoccupied house is ideal, and if someone answers when you ring, it’s easy enough to make up an excuse and walk away.
A much better solution than a gun, though, is a security door (similar to a screen door, but more kick proof).