You might hate hearing it, but as far as I'm concerned, the shotgun is still the king of home defense. The shortest you can get one, however, is 18 1/2" of barrel, and possibly add on a folding stock - this is one reason with the most validity that I'd choose a handgun over a shotgun, in a very tight quarters situation. Shotguns are also heavy and "require" 2 hands to operate (you can use one and a forearm, or something, but you would still need to pump after the first shot).
Rifles need to make use of a longer barrel in order to achieve those velocities that disrupt a ton of tissue, which is their shortcoming - one of the reasons why I'm waiting for the Kel-Tec RFB: a bullpup semi-auto .308 which addresses trigger linkage and ejection concerns - the 18" carbine has a 26" overall length.
Even so, I may well choose a pistol for home defense anyway. They're maneuverable and harder to take away, can be used accurately with one hand, and can have a light (and laser) mounted just like a rifle or shotgun may. Shot placement is important with anything - just somewhat moreso with a pistol. That is the give and take of advantages and disadvantages when choosing a weapon - there are many factors to take consideration of.
More than half of shooting a pistol accurately is how you condition yourself, mentally. A very loud, sometimes quite concussive explosion is taking place merely a couple feet from your face. As a result, many people flinch in anticipation of the shock, the feel of recoil, and the movement of the pistol, thus losing their concentration at the critical moment. Your shot will be affected by how you move the pistol during and after the trigger pull, so you must learn to follow through, keeping the sights on target, and
letting them return to the target after the shot is made. Relax, and let the gun do the work - its weight will keep it steady, its push from the shot will only receive an equal push from your hand, falling back on target when your wrists are properly tensioned and aligned.
To get a proper grip on the pistol, first doublecheck that it's unloaded, then place the highest point of the backstrap into the web of your dominant hand. Make sure that your hand is as high up as it may go, as more recoil will be directed backwards, and muzzle flip will be lessened. Keep your index finger straight, and wrap the rest around the grip of the pistol, keeping your thumb high, but away from the slide stop. Now place the heel of your non-dominant hand in the space leftover, just under your thumb. Wrap your four fingers around the other 3, lending them support, and place your thumb straight forward against the frame, keeping it below the slide. Put your dominant thumb upon the knuckle of your non-dominant thumb, and apply forward (against recoil) pressure with your dominant hand, matching that by pulling back with your non-dominant. You need a firm grip, but not one that you'd use to shake the hand of the devil himself.
If you've got it right, the pistol will move straight up and down when you rotate your wrists to simulate the direction of recoil. If it moves up and to the side, make sure the pistol is in the
center of the web of your hand. Do not lock your elbows in a two-handed stance - instead let them move to absorb the recoil, so the pistol may move straight back and forward, instead of your shoulders forcing it up and down.
Checking that it's unloaded again, dry fire from this position using snap caps if your pistol needs them. Use only the pad of your fingertip, not the knuckle, and practice the trigger pull, watching how the sights move in your follow through, possibly placing the round off target. Draw to this position a number of times, so it's the same each time, and I personally guarantee your shooting will become worlds better.
-m00t!