In a comprehensive book, Castle, by Garvett, a castle is the fortified private residence of a lord, a home as well as a stronghold. Within the castle, a staff of many was responsible for the needs of the structure itself and the needs of the community inside the walls.
Early castles, built in the 9th and 10th centuries, were constructed of earth and timber. 11th century castle design consisted of an earth mound (motte) and the enclosure or yard (bailey). The motte was built of rammed layers of soil and was topped with a timber tower. The bailey was a large are protected by fence with a ditch around the exterior, fed by stream. A good example of this type of structure is in Pleshy, England. The remains of the 1066 Norman stronghold show a large bailey and motte. These early castle structures could be built in months rather than years like the stone structures that followed.
from http://www.castlewales.com
In the 10th and 11th century, the building material and the form of castles changed. Still replaced wood as attackers less easily destroy it. Large stone towers became both the residence and a military building. They were called great towers or donjons. Improvements in castle design allowed for great halls for large gatherings; lavatories called mural chambers or garderobes; fireplaces with flues, built into the walls; and stylistic elements such as Norman or Romanesque arches. Windows high on the castle walls allowed light and air in. Shutters were used in bad weather to keep out the wind, cold, and rain.
Concentric castles were built in the mid-13th century. These structures consisted of rings of stone walls, the lower outer ring being used as a barrier against catapults. The high inner stone ring gave archers an advantage in defending against attackers. Towers within the concentric rings could often be sealed off if attackers breached the outer rings. Castle built during this time often had gatehouses with drawbridges. Additional protection from attack was the addition of the moat that prevented tunneling under castle walls or kept siege machines at a safe distance.
As castles became more prevalent in Europe, design and style unique to each region developed. In France, castles became more luxurious and better fortified. Saumer castle, located on the Loire River, had a courtyard well and underground water tank. A large wooden winding mechanism was used to retrieve heavy buckets of water. Beautifully painted floor tiles and lavish tapestries competed with the elegantly dressed lords and ladies of the court. The outer walls were adorned with flying turrets and machicolations (openings) used to drop materials at attackers.
In Spain, the Moors built square or wedge-shaped alcazabas or garrison forts. Their enemies, the Christian knights, built torres del homenaje or tower keeps. The fortified palace known as El Real de Manzanares was built around 1435 and is a combination of both styles; a square shape with round towers. The stone from the region is reddish-brown in color and looks rugged and earthy compared to the white stone castles of northern Europe.
from http://www.artehistoria.com
German castles were more numerous as many were built by lesser lords and barons. Here the land influenced castle design. Atop hills and mountains, castles could be defended more easily. Large moats or the waters of the Rhine offered protection and allowed for larger windows to be built into the outer walls (see image of Pfalzgrafenstein castle below). Another typical castle structure in the Rhineland is the Randhausberg (translated Edge Mountain). This type of castle was made up of fortified domestic buildings built around the castle tower courtyard. The Teutonic Order of the monk-knights built structures of brick for defense, which housed residential and religious areas.
Five sided tower of the Pfalzgrafenstein castle in Pfalz Island in the Rhine river near Kaub, Germany
Strongholds were built in Japan in the Yamoto period (AD 300–700). More prominent wood structures appeared in the 14th century. By the 17th century, Japanese castles were more complex, with many baileys to protect the central tower. They main wooden structure was many stories high with the stone base. To protect against fire, the wood was protected with thick plaster and the gates were covered with iron grates.
Himeji castle in Japan from
www.tripzilla.com/original-castles-japan/57479
As castles became more complex, a variety of buildings and structures were needed to address the needs of the residents. Chapels were an important part of Christian castles and were elaborately decorated with religious items and paintings. Early on, the soldiers required to defend the castle lived within the walls. Later, knights and soldiers lived outside the walls and used the castle as a base from which to control the surrounding countryside. In the 17th and 18th centuries, castles for used as prisons for common criminals. Before that time, most prisoners held at castles were political or state prisoners and were held for ransom. The people, industry and activity in and around the castle included: cooks, bakers, a wives (women who brewed ale), monks, pages, squires, ladies-in-waiting, laundresses, seamstresses, entertainers, storytellers, musicians, jesters, leatherworkers, woodworkers, carpenters, metal smiths, blacksmiths, stone masons, farmers, beekeepers, and orchardists.