(N.B. I am not considering 5" and 76mm guns in this discussion. Nothing has fundamentally changed there since the development of the VT fuze) during the Second World War.
Very short range defense against incoming missiles, or "point defense", was initially a crash program within the Navy, which became very interested in point defense in 1967, following the sinking of an Israeli destroyer after it was hit by a number of Styx missiles.
The first system was pretty slapdash, but it worked. It was the "Basic Point Defense Missile System" or BPDMS. It was a system that would have made McGyver proud and it was developed and implemented at near-record speed for a non-hot war procurement situation.
BPDMS took eight Sparrow missiles, straight from the stocks for F-4s, and put them in a trainable box launcher. It took two of the nose radars from an F-4 and mounted them on a separate hand-slewed mount. There was a little CRT in the mount with an eyepiece so the operator could press his face to it (avoiding showing light at night and keeping rain off it). When it was turned on, the operator would be told, by sound-powered telephone, where the target was. He would slew his radar rig to that and elevate it as necessary. The missile box would automatically train and elevate to follow the radar director. The operator would both acquire the target and fire at it.
The disadvantages were obvious. BPDMS relied on a man, standing outdoors, to work it. At night, in the rain, in the cold, whatever the weather, somebody had to be at the director in order for it to function.
NATO Sea Sparrow got rid of the human-operated director;
NATO Sea Sparrow also began the process of "navalizing" the Sparrow missile to make it better suited for shipboard requirements. BPDMS,as I mentioned, had taken the issue Sparrow as used by fighters. That was fine for a crash program, but it was not optimal, so a naval variant was developed.
NATO Sea Sparrow, however, was not suitable for ships much smaller than a destroyer (though BPDMS had been installed on frigates). The Phalanx Close-in Weapon System, CIWS, was developed for smaller ships, though it has been installed on everything up through aircraft carriers. The idea of CIWS was to have a system that could be welded to the deck in short order, if necessary, with only lines run to it to provide for electricity and command capabilities.
CIWS can be fully autonomous, though it can also accept designation from CIC. CIWS has its own tracking and acquisition radars in the white dome. The gun is a 20mm gatling gun which when loaded for wartime, fires sub-caliber (saboted) depleted uranium projectiles which are supposed to smash into an oncoming cruise missile and cause it to blow up. CIWS was often referred to as "R2D2".
CIWS worked. Some navies went for a larger gun, such as Goalkeeper, but the larger systems require penetrating the deck to mount part of the works below the deck, which limits where the mounts can be placed.
The last line of AAW defense is, of course, damage control.
 You may see references that say that BPDMS used a modified ASROC box launcher. Those reference are full of shit. The BPDMS launcher box system was a lot smaller than ASROC.
 CIWS is also a generic term for any close-in defense system.
 There is a potentially serious problem with this idea. A CIWS kill will take place between 300 and 500 yards. Eastern-bloc antiship missiles were designed to disable large ships and it is highly likely that they use some type of shaped-charge. Detonating one a few hundred yards from a destroyer might still sink it. Even if the thing blows up omnidirectionally, the shrapnel has a good chance of fucking up the ship's radars.
53 seconds ago