there are a good defense, when you are not connected:
look my castle in french version:
and for ratio:
when you are attacked, and the attacker going on 3 sides, he has a bonus to 30% in courtyard, on 2 sides there are no bonus, and on 1 sides, he has malus to -30%.