Walls served many functions: they were a defence against opposing armies (though artillery later rendered them militarily obsolete), they kept out wrongdoers at night, they controlled the movement of goods which might be taxed or subject to town regulation, and they defined the town's immediate jurisdiction.
They also look nice, so it's a pity that most have gone.
Improvements in agriculture made it possible for a smaller number of people to provide food for a greater population. This had the effect of making it possible for a larger number of people to live in towns and cities.
Transportation improved, and with it there was an increase in trade. Trade centers became important, and these, of course, were towns and cities.
Governments worked out a number of different ways of making their territories more secure, and this benefited towns and cities.
The important people in the towns and cities themselves eventually took control of the operation of their communities in many places, for the benefit of the communities, which made them more prosperous and secure, attracting a larger population. The republican communities, called communes, in Italy exemplify this.
There are links below to articles on the medieval communes and the High Middle Ages, which was the period of greatest growth of towns and cities.
People learned to grow crops and development of cities and towns were a natural outcome. With towns people have protection, services, government, shops, trading, and religion. They live better than they would alone.
The stone walls would help protect them from attackers or raiders.
The walls were for protection from invaders and helped the residents defend the town.
Depends on how big or how much. Typically rock quarries or cliff walls are the common source of stone.
in medieval towns
Medieval towns did were not designed so much as they developed by happenstance. There were some exceptions, including walled communities, in which the question of what was inside and what was outside the walls became very important. The walls were usually planned either by a local lord, in the case of feudal towns, or by a guild or set of guilds, in the case of medieval communes.
Tapestries are a form of artwork, and were used to decorated the walls. Tapestries also made the walls seem warmer in large rooms, where the walls were usually made of stone, because they insulated the people in the stone, which conducts heat rather well and was often very cold in the winter.
Merchant guilds dominated the economic and political life of medieval towns.
that way the town could be protected from invaders
Depends on how big or how much. Typically rock quarries or cliff walls are the common source of stone.
The medieval stonemasons built large structures like Gothic cathedrals, churches, castles, etc. out of stone. Modern stonemasons build stone walls and decorate the outside of floors, walls, etc. with stone.
in medieval towns
Medieval towns did were not designed so much as they developed by happenstance. There were some exceptions, including walled communities, in which the question of what was inside and what was outside the walls became very important. The walls were usually planned either by a local lord, in the case of feudal towns, or by a guild or set of guilds, in the case of medieval communes.
Medieval towns were independent by buying a royal charter.
Medieval towns were crowded because serfs wanted more freedom and moved out of the manor land to towns.
Tapestries are a form of artwork, and were used to decorated the walls. Tapestries also made the walls seem warmer in large rooms, where the walls were usually made of stone, because they insulated the people in the stone, which conducts heat rather well and was often very cold in the winter.
... ..........
Some medieval towns transportations were wagons or carriages. Some people just walked.
A castles main defense were it's high stone walls and sometimes a mote, a channel of water
in a Knights stone house