Castles could include a warren of houses and shops, as well as its tradional parts shown here. The houses and shop could be built against the castle walls, or if there was enough space in the center, there.
Nottingham castle was built by the Normans in early century. It wasn't until after the Nottingham uprising in that a sheriff was placed there, since no one was the owner. Nottingham is famous for the Legend of Robin Hood.