Sty
A sty or pigsty is a small-scale outdoor enclosure for raising domestic pigs as livestock.  It is sometimes referred to as a hog pen, hog parlor, pigpen, pig parlor, or pig-cote, although pig pen may refer to pens confining pigs that are kept as pets as well. Pigsties are generally fenced areas of bare dirt and/or mud. "Sty" and "pigsty" are used as derogatory descriptions of dirty, messy areas, the word sty deriving from the Proto-German stijan meaning filthy hovel. There are three contributing reasons that pigs, generally clean animals, create such a living environment:

Pigs are voracious eaters and will eat all the plants in the enclosure until there is nothing left to control erosion.
The pig will naturally root and dig for food in the enclosure, further disturbing the soil.
Pigs do not regulate temperature by sweating  which means that they must be provided with water or mud in which they can control their own body temperature.A large-scale enclosure for raising pigs is generally called a hog lot.  Unlike a sty which would be found on a mixed farm, a hog lot is usually a dedicated facility. 
A locked enclosure with confined/restricted movement & freedom to exercise, is known as a boar-stall. Although, according to some experts forced immobilization was believed to elevate cortisol.

Family farm hog pen
The family hog pen was a small-scale system of pig farming found on family farms of the early 1900s, although backyard pig farming does still occur. Family hog pens enclosed just a few hogs to provide year-round meat for the table. Before refrigeration, some family farms depended on pigs as a primary source of meat and shortening (lard) for year-round food.  Farms which had tenant families might have several hog pens. This is vastly different from the modern American hog farm which have an average of about 2,000 hogs, with the largest raising hundreds of thousands.

The hog pen
Farming pigs outdoors poses problems, but the small scale of family farming made it possible to manage these problems.  In particular, hogs suffer 'heat stress' in high temperatures and have no sweat glands to naturally cool themselves. To cool themselves, hogs need access to water or a 'wallow', which is an area of mud.  Without access to water or mud, pigs must wallow in their own excrement. Normally, pigs avoid their own excrement; pigs do not defecate just anywhere in their pen–they use one corner of it for their 'toilet'. Ideally, a cement wallow which contains water cools the pig much better. Alternatively, shade may be provided for the pigs. Pink pigs are especially prone to sunburn.  
Many family farm hog pens were improvised enclosures made of any handy free material. The pen is often kept small to conserve building material and effort.

Slopping the hogs
Historically, these farms fed hogs on grain, fruit and vegetables that are not fit for sale or family use.  Overage produce from the farmer’s market and table and restaurant scraps were often diet elements as well.  This practice of 'swill feeding' (feeding table scraps) is considered a disease risk today, though this is mainly associated with feeding meat to pigs, which is banned in many countries. Hogs were also fed "slops" made from middlings or corn meal stirred with milk and water.  
Historically, hogs were also allowed to forage in gardens and orchards after the harvest was over.  Such foraging can cause erosion and runoff, but the small scale of these operations prevented this from occurring.

See also
Aldred's Case
Pig farming
Pig slaughter
Pig toilet
Slaughter house
St Fagans National History Museum


== References ==