Traditionally most urban Chinese used to live in quadrangles called siheyuan or "four-side enclosed courtyards." These courts, as the name implies, are formed by inward-facing houses on four sides, closed in by enclosure walls.
A small or medium-sized siheyuan usually has its main or only entrance gate built at the southeastern corner of the quadrangle with a screen wall just inside to prevent outsiders from peeping in.
Such a residence offers space, comfort and quiet privacy. It is also good for security as well as protection against dust and storms. Grown with plants and flowers, the court is also a sort of garden.
In feudal times, the courtyard dwellings were built according to the traditional concepts of the five elements that were believed to compose the universe, and the eight diagrams of divination. The gate was made at the southeast corner which was the "wind" corner, and house was made to face the south with the main building on the north side which was believed to belong to "water"-- an element to prevent fire.
All the quadrangles, from their size and style one could tell whether they belonged to private individuals or the powerful and rich. The simple house of an ordinary person has only one courtyard with the main building on the north facing, across the court, the southern building with rooms of northern exposure and flanked on the sides by the buildings of eastern and western chambers. The mansion of a titled or very rich family would have two or more courtyards, one behind another, with the main building separated from the view of the southern building by a wall with a fancy gate or by a guoting (walk-through pavilion). Behind the main building there would be a lesser house in the rear and, connected with the main quadrangle, small "corner courtyards".
The lord and lady of the house lived in the sunny main building and their children in the side chambers. The southern row on the opposite side, those nearest to the entrance gate, were generally used as the study, the reception room, the man servants' dwelling or for sundry purposes.
Not only residences but ancient palaces, government offices, temples and monasteries were built basically on the pattern of the siheyuan, a common feature of traditional Chinese architecture.