A lot depends on where exactly these barns are and what you mean by "barns". I'll answer from a historical English context:
In the early Middle Ages barns could be meeting houses as well as dwelling places. Longhouses are the earliest buildings that we would recognise as barns. Across Northern Europe this kind of building was occupied by clans/tribes/families and could therefore be said to have been for communal use. Places in England that centred around a byre/barn often have by at the end of their place name - one such place is Anlaf's Byre, modernly known as Anlaby.
In the later Middle Ages smaller dwellings with single families (often an extended family rather than today's smaller units) became more normal and barns became used primarily as storage for agricultural products and less often as dwellings. The name "barn" remained in use for larger buildings that were used communally for administrative functions rather than dwelling or storage use (e.g. Tithe Barns) but, in short, they began as largely communal dwellings and evolved into the kinds of storage buildings that we would recognise today.
Sources:
M Aston - Interpreting the Landscape (1985)
H Kaemmer - The organization of social space in late medieval manor houses: an East Anglian Study (2003)