Entering a house, a museum, an office building or a shopping center, you probably take for granted that your comfort and safety are not in jeopardy. Even if the building is ugly, such aesthetic shortcomings are unlikely to prevent you from occupying and using it.

But who or what guarantees that designers will design and builders will build sound structures, if not works of art?

Virtually all government jurisdictions have enacted building codes to protect the interests of the public. And they usually employ officials to enforce provisions of the codes.

Of course, you hear little about building codes and code enforcement; it's not exactly a hot spot of government activity or citizen activism. To most people, zoning policies and regulations are far more significant and controversial because they directly affect the use and value of land, the character of neighborhoods and the size and bulk of buildings.

The United States has thousands of building codes. Every county and municipality has codes, as do some states. Fortunately, several model building codes -- the Building Officials Conference of America code, the National Building Code and the Uniform Building Code -- have been developed nationally and adopted by many local jurisdictions. Nevertheless, local concerns result in customized codes that reflect beliefs, traditions or special interests unique to a particular community or region.

For example, some jurisdictions refused for many years to allow plastic piping in buildings. Occasionally, a locality would demand that wood studs, used to frame exterior and interior walls, be no more than 16 inches apart, even though 24-inch spacing had become acceptable. This was especially appreciated in states that produce timber.

The District of Columbia requires sloping roofs to be drained via gutters and downspouts connected to underground storm drains. Other jurisdictions permit downspouts to dump water onto splash blocks while some jurisdictions don't require gutters and downspouts at all.

Influential building trade unions and product manufacturers often have been blamed for effectively lobbying city and county lawmakers to adopt code provisions to protect their economic interests. The cast iron pipe industry was long considered the villain in blocking the use of plastic pipe.

Reading a building code is about as exciting as watching paint dry. Codes are full of boiler-plate language, charts, sections and subsections, all of which set criteria for the design of various building systems.

One of the first steps in interpreting and applying a building code is to determine the type, or class, of building being designed. For instance, a building's classification -- related to use, occupancy and size -- determines how fire safe it must be.

A private, detached residence needs little special treatment for fire protection; it can be built of combustible materials, have only two doors and be equipped only with smoke detectors. On the other hand, a school building or place of public assembly requires incombustible materials, multiple fire escape routes and exits, detection and alarm systems, and fire and smoke suppression equipment such as sprinklers and standpipes.

Indeed, except for residences, building codes are very specific about fire emergency exits. At least two alternative routes must lead directly to the outside from all suites or major spaces in a building through fully enclosed stairs and fireproof corridors of limited length. These exits must be clearly marked by code-approved signs. Exit routes must have emergency lighting and be wide enough to accommodate fleeing occupants.

Beyond fire safety, codes also regulate structural safety. Again, building classification, room-use occupancies and geographic location dictate how much loading, in pounds per square foot, must be assumed to act on roof, floor and wall surfaces. By law, engineers must design structural components to carry the code-stipulated forces.

As one moves south to north, codes demand deeper footing and foundation depths to eliminate frost heaving. In South Florida, a slab on the ground may be adequate, but in the Northeast, footings around the perimeter of a building must reach down at least three to four feet below grade.

However, building codes do not tell an engineer exactly how to design structural elements. The shape, dimensions and material composition of a footing, column or beam still are determined by the designer. It is the designer's expertise -- along with technical reference manuals full of data about steel, concrete and wood -- on which public safety depends.

In addition to fire protection and structural performance, codes regulate other building elements affecting comfort, health and safety. These include the height and configuration of railings on balconies and roofs, the types of glass in windows and the size and rating of gas and chimney flues.

Codes require that bedrooms and living rooms in houses or apartments have at least minimal window area for natural light and ventilation. Bathrooms and kitchens without windows must be mechanically ventilated. Spaces for public occupancy in all buildings must have adequate ventilation, usually a combination of fresh and recirculated air, and must be maintained at reasonable temperatures. Buildings with special uses, such as restaurants, laboratories and manufacturing plants, are subjected to even more stringent ventilation and air-quality control regulations.

In recent years, many jurisdictions have added energy conservation criteria to their building codes. These require minimal insulation ratings in roofs and exterior walls. Again, the precise method for achieving these insulation ratings is left up to individual designers and builders.

Electrical codes, also based typically on national standards, specify installation and performance criteria for panel boxes, switching gear, circuit wiring and fixtures. Not all types of wiring are permitted from city to city. Electrical codes, while governing the placement of convenience outlets in rooms, do not prescribe type, quantity or location of lighting.

Plumbing-related statutes presumably ensure adequate bath and restroom facilities. The type, size and layout of piping also is regulated by provisions that, among other things, mandate venting of waste traps, minimal downhill slopes for waste pipes installed laterally, and water supply pipe joints able to withstand standard hydrostatic pressures. But plumbing codes do not ensure that piping will be noise-free when water is running or a toilet is flushed.

With new products and new knowledge, building codes evolve. Today they prohibit the use of lead-based paints and asbestos-based coatings but allow synthetic materials never imagined before. Requiring access for the handicapped, unheard of 30 years ago, now has become the norm.

Manufacturers continually develop and test new materials and then sell them to designers, builders and the public. This occurs faster than codes can be updated by legislative bodies. Consequently, building permit officials and inspectors have considerable administrative authority and control over the fate of proposed projects. Not only can they determine whether a design, building material or installation meet code requirements, they also determine how long it takes to make the determination. And sometimes it seems to take forever.

Little wonder, then, that architects, engineers, developers and contractors strive to maintain the friendliest of relations with local building code enforcers.

Building codes ultimately have little effect on a building's architectural style or urbanistic character, and they don't ensure quality materials or workmanship. Codes only establish minimum thresholds of performance, and their effectiveness is wholly dependent on the intentions and competence of human beings who write, enforce and comply with them.

Roger K. Lewis is a practicing architect and professor of architecture at the University of Maryland.