Answer:
Early castles were of the motte and bailey type. They had an enclosure with wooden sides built at the top of a small hill and connected to a lower enclosure, also with wooden sides. They worked fairly well at the time, but they were far from perfect. They had the advantages of being quick and inexpensive to build, so they continued to be used for a long time.
Later castles were usually made of stone, though brick was used for some, especially where stone was not available. The stone castles were more complicated and more expensive, and the took much longer to build. But they also lasted longer than wooden castles did, and they were much harder to defeat.
In time, the concept came about to have a castle built inside a castle. If an attacking army breached the outer walls, the defenders could retreat to the inner stronghold. This was called a concentric castle, and represented one of the most defensible types around.
During all this time, castles also improved in regards to comfort. Early castles were really just rather refined forts. As time went on, castles were built with better living accommodations so the lords and ladies, and kings and queens, who might live in them could do so in greater comfort. Early castles were so uncomfortable that most people would not want to live in one, but later ones could turn out to be the place a person preferred to live.
There is a link to an article below, and by following it, you can get more details.