A castle can be either a large stone building used as a fortified base or an elaborate building occupied by nobility (though the latter is most often called a palace). While no castle was completely impregnable, with the resources of the day most could only be reduced by a long and costly siege.
The design and function of castles adapted as the weapons of the period changed. For instance, with the development of cannons, the walls and towers had to be adapted to mount such artillery, and they had to be thickened in order to weather being struck.
- motte (as in motte-and bailey) -- an artificial (very occasionally a natural) mound upon which early Norman keeps were set. A means to gain height without requring a broad base or a serious risk of structural instability.
- bailey (as in motte-and bailey) -- the bit below the motte, usually flat(tish), wehere the rest of the castle's buildings went; usually surrounded by a wall. Later on it became used for open portions within a castle, and then often came in 'inner', 'middle' and 'outer' flavours as appropriate. Also known on occasions as a ward.
- keep -- big tower, usually the principal tower in the castle. In a simple castle, this would be where the main rooms would be. Later the comfortable bits moved into tailor-made structures, and the keep became something like the conning-tower of the castle.
- gatehouse -- a defensive structure over and round a gateway into and out of the walled area. In some castles the major defensive work, which subsumed into itself the function of the keep.
- portcullis -- think "Robin Hood" movies: this is the waffle-pattern thingie that drops down from above to block a gateway. The idea is that, in a siege, since the attacker needs to get in, but the defender doesn't need to come out, this blocks the attackers' progress, while still letting the defender fire arrows and the like through the holes.
- towers -- hands up those who need explanation here
- turret -- a small tower, sometimes one perched at the top of the wall that doesn't reach the ground (think D*sn*y). Nothing to do with being unable to control your speech pattern.
- barbican -- a defensive work built out from the main castle. Often an advance gateway, with its own gatehouse, and walls, restricting the width of access to the main gate.
- moat -- large ditch, sometimes filled with water, surrounding a castle. In some cases this connects to a nearby river or to the sea, providing an access and escape route. Otherwise its main feature is that it stops it being so easy to get to the walls, or to dig under them. A dry moat can also be called a foss.
- drawbridge -- To get over a moat or foss you need a bridge: a drawbridge is hinged at the castle side, and can be raised or lowered from inside, thus completing the moat's circuit without boxing everybody in; but letting the inhabitants box everyone else out.
- battlement -- the up and down bits on top of a wall -- the ups are merlons, the holes between crenels (hence the alternate term crenellation)
- postern -- a small gateway, often used by the defenders to rush out at attackers to surprise them. Hence it is also known as a sally port: a port or gate from which you make a sally.