The urbanization of Japan can be said to have begun in the Tokugawa period. An edict of 1615 restricted the daimyo to just one castle in their territory and another law forced all the samurai to live within the towns that grew up around these castles. This is the origin of the Jokomachi.
One of the best preserved jokamachi is in Hagi, Yamaguchi Prefecture, seat of the Mori domain. Spared destruction by the development that followed the construction of railways and stations, the rail line skirted Hagi and so the grid of streets making up the old town still remain.
The very highest ranked samurai lived within the castle grounds behind the outer walls, but the next highest ranked lived right next to the castle. As the rank descended the samurai lived further and further away from the castle.
While the poorest samurai lived in quite crude accomodations, the higher ranked samurai lived in mansions surrounded by high walls.
many of these walls were plastered and painted, but some were left plain. The ones built using old roof tiles are particularly striking.