A shotgun can be good for home defense if you have one room everyone can gather in. It should be strongly secured. A good way to do that is to drive nails into the door frame on the hinge side every 3 inches and clip the head off leaving about 1/3 inch of nail exposed. Drill holes into a solid wood door for the nails so when you close the door it's like a bank vault with the nails every few inches top to bottom. Put a pair of long throw deadbolts in the other side 1/3 and 2/3 from floor to door top. Have a bed in the room that everyone can get behind and be behind it with your shotgun. DO NOT rack the slide once they are in the house. That tells them what you have and where you are. It also reduces the capacity of shells by one unless in that worst of all possible scenarios you are going to remember to replace that round. Have the gun charged and fully loaded with the safety lever being pressed as the only requirement for putting the gun in service. Secure everyone in your safe room and sit it out. Everything outside that room is between them, insurance and police. If they manage to breach that door, and it's not likely, it's between them and the shotgun.
DO NOT take a .22 or .25 to a fight and think long and hard before taking a .32 as well. They are NOT personal protection calibers. Yes, they are lethal. The problem is they are not effective quickly. They may be fine sometimes but there are cases of guys high on drugs being shot with them and spending 10-15 minutes beating the you know what out of the person who shot them before being incapacitated.
Glock is the number one choice for dependability and proven record. The torture tests they've been subjected to and continued to function are numerous. It is hard to imagine they could function but they do. There are others equally good as far as quality but they aren't as capable of reliable functioning in adverse conditions. Granted, a prudent person isn't going to let their gun get near the level that would cause a stoppage however there's nothing wrong with having the one that is most resistant. Glock also has one of the most easily mastered trigger pulls of any pistol. 9mm is an excellent choice. It doesn't hit as hard as some but it hits plenty hard enough and is easier to control for follow up shots. Three controlled hits from a 9mm in the same time as 2 hits from a .40 or .45 is every bit as good and probably better.