Something I noticed when attacking castles is that the defenders, especially ranged units, tend to clump up in the courtyard rather than the walls, defeating the purpose of the walls.