Masons/Castle Builders
Masons in Medieval times were in charge of building castles for nobles. They would be hired by a noble to build a castle for the noble's protection. The main purpose for a castle was for protection not for comfort. Masons and castle builders tried to make the castle as safe to be in as possible. In the castle it wouldn't be the best life, but they would be protected well if a siege came upon them. Only rich nobles, like lords and kings, were able to have a castle since they were so costly.
Some of the things that a mason would do to make it safe would be to make it easier for the defenders to attack the attackers. They would make loopholes in the castle so the Bowmen would have an easier time shooting arrows from the castle than the attackers shooting arrows into the castle. They would also make the staircases spiral so that when a knight came down the stairs, he would have an easier time hitting the attacker than the attacker hitting him. They would also make the corners of the castle, the turrets, rounded so that if someone tried to ram it or catapult a rock at it, it would be deflected off and they wouldn't get a hard hit. They would also have the drawbridge and the portcullis at the gatehouse used as protection when attackers tried to get in. In the gatehouse, the defenders would besiege the attackers through little murder holes by pouring either hot sand or boiling water.
When an army tries to take over a castle, they usually bring weapons such as crossbows, bows and arrows, trebuchets, food and supplies. If the attackers couldn't get into the castle, they might try to wait them out. Sometimes, the attackers might run out of food before the castle does, so the defenders might win the battle. When they attacked the castle they might try to dig a tunnel underneath the castle, and then make the tunnel collapse making the wall of the castle collapse too.