People have been living in groups, behind enclosures such as fortress walls, for centuries. Medieval castles were kind of like a form of gated community, if you think about it. In the Tang period in Chang’an China, over 1000 years ago, there were more than a million residents who lived in walled neighborhoods behind gates. …