I cannot understand why the troops in the barracks cannot defend the city when there is an attack. I think it's quite logic to use them in a defensive way too.
Well if the troops would defend, then it would be impossible to raid anyone, considering how hard some bases are with garrisons, alliance troops, etc. as well as the various defenses. Its the same way with COC, if they had the troops defend, then raiding would be impossible.