Most people use warriors because they are fast and cheap to make. Swordsman are more expensive and can be time consumming when you start taking major losses. If you have your gates open than your soldiers will leave your city to defend it. They will be calculated in the battle and can be killed. Otherwise if your gates are closed than your soldiers stand aside and watch the enemy raid your town (If they can get past your fortifications). Also having the gate opens will allow your scouts to engage enemy scouts when you are scouted.
If I helped, add to my rep please.