I never liked shotguns, sure you can throw a cone of pellets, and likely get a hit with massive noise/recoil and a package size that's a bit big for hallways, and they're cheap in general. AR15's are also well liked for use in a home, though still loud and decent sized, recoil is not an issue.
For a handgun in .40, it comes down to what fits your hand and what safety you're looking for. Glock, Walther, S&W all make reliable options with a no-frills, no safety config. SIG or HK are pricier and the double action/ single action is a bit more between you and firing the gun. Beretta's in general have the safety and double/single action, so you've got that extra bit between you and firing. (more barriers= more to remember understress, but also that extra step for some folks is a nice thing to keep in mind).
I don't care for .40 caliber, .45 is more fun, 9mm is more economical and easier to shoot. Grasp the guns to see what points well for you (hands aren't the same), make your purchase and learn the tool you get.
Assumedly the OP is more comfortable on this forum as opposed to looking for a specific forum dedicated to guns and then trying to learn from there. As with video games, individual gun forums are generally full of folks dedicated to a particular style, so the answers would be self-selecting/ biased anyway.
More to the point, the folks making off topic posts should be kind enough not to need to post their off topic opinions and clog up someone elses thread, but I guess everyone has to throw something in.
I honestly don't think that current gun ownership laws are in line with what the founding fathers had intended...but the supreme court comes back time and again stating that 2nd amendment rights cover rights of ownership even if they aren't connected to a 'well regulated militia'.
Home defense? Do you live in Iraq? How many times have your home been invaded by armed individuals trying to kill you?
If your home does get invaded by armed men will you start a shoot out putting your family in cross fire?
If it's for home protection and only home protection I would recommend a pump action shotgun instead of a hand gun. Incredibly easy to use, very difficult to tear up, the sound intimidation can be enough to remove a threat before you have to fire, they are far less likely to penetrate a wall/door and hurt a neighbor or pet. Price is reasonable and a 9 shot spread instead of 1 increases the chance of hitting a target.
I do not have a .40, but I have a Kimber .45 pro carry II, a Sig Sauer .380 p238, and a Springfield XD9 for personal carry. What I carry depends on the weather and what I'm wearing. I've found the are all very reliable and better at putting fire on a target than I am. If we had a natural disaster and I had to grab one hand gun and get out the door it would be the Springfield. I've shot a lot of glocks at work, they have a great reputation for reliability, but Springfield does too. For me the size and shape makes it easier to get on target, for some people the glocks work better. Springfield makes a .40 in almost all of it's platforms and they are usually reasonably priced. Comparable to Glocks but less than you'll give for a Kimber or other high end 1911s.
Find a gun range with rentals and try out what works for you. After you get it, break it in with different ammo and find an a round you want to use for home protection. Shoot a lot of it. You need to know how it changes your point of aim and you need the confidence that it goes click boom and not click oh shit. .40 is a great round but if you aren't married to the gun yet I'd recommend trying anything that's available. Also consider if you would want to carry it and keep that in mind.
Springfield, rugger, colt, or just buy an Uzi. altho in the US to be able to apply to have an Uzi you first need a federal gun permit as a state is not high enough priority.
i like my Springfield xd40 sub compact. Its my carry weapon and would be great for home defense. Although for home defense i have a Remington 870 12ga with a pistol grip, and i also have a 9mm AR15 with a 7" barrel and suppressor so that is a nice quiet entry package too. Although id like to mention i buy my guns more for fun than for the threat of home invasion, but if it ever happens i feel im the most prepared i can be.
I don't like glocks, they are crap in my eyes, mainly because they don't seem to have a consistent ejection, the casings go everywhere.
For the people against using a shotgun, i would like you to be awoken from a dead sleep, in a state of complete disorientation, and try to efficiently put rounds where you want them. Some can, some cant, but a shotgun only needs to be pointed in a general direction.
'Merica !
Are you familiar with insurance? You call the police and barricade you and your family in a room and dont put yourself or them at risk by confronting people. Nobody dies, you get money for your stuff, the criminals have a 60% (depending on where you live) chance of getting cought and everyones happy.
Is america really so savage that people regularly break into houses to rape and kill everone in there? I have traveld quite a bit and the only other place I have encoutnerd that metnality was when I was in Afganisthan. Not even in South Africa does people seem so afraid of this as americans. I have never encounterd a population that is so afraid and generally scared as americans.
Prepare for the worst. Of course, it's up to each person to decide what their worst case scenario is, but I tend to go full doomsday as far as that goes.
And there is a bit of innocence lost to having your home broken into. Your family ain't going to be happy regardless of what happens.