There is a place in Terra Nova (Richmond, BC) where the new subdivision encroaches on an old, open field. Here, three types of swallows fly and feed: Violet-green, Tree, and Barn Swallows. It's a fine place for swallows, with vegetation of mixed heights, scattered orchard and birch trees, and broad, water-filled ditches. These features attract flying insects, and flying insects attract swallows.
If you stand were I took the above photo, you can see all three swallows swooping over field and ditch, and then the first two species, crops full of bugs, flying to the boxes placed there for them. (Aside: I believe Trees are the more common users of these boxes at this location.)
The third species, Barn Swallow, eschews nest boxes. It flies from the field, over the boxes, over your head, into the subdivision, where it has constructed its mud cup nest in a sheltered place, such as on top of a motion detector, under the corner of a roof. Prior to the advent of permanent human structures in North America, Barn Swallows nested in loose colonies in caves or against sheltered cliff faces. Now it is estimated that less than 1% go this old-school route. The vast majority nest on or in human-made structures, with their reliable roofs and numerous nooks and crannies: barns, bridges, picnic shelters, your front porch. Trees and Violet-greens, by the way, are classified as cavity nesters, and in the absence of wooden boxes on sticks nest in abandoned woodpecker nests (tree swallows, especially) and other natural cavities.
It is the choice of nest-site (and mode of nest construction) that make Barn Swallows the best known of the group, but not for good reasons. Poop and swoop: whatever lies beneath a nest inevitably becomes guano-ized. And if a nest is approached, even in a casual or distracted manner, vigilant adults swoop, and say chewink!
Right now is peak season for becoming annoyed with Barn Swallows, a pan-continental phenomenon. I know this, because checking the referrals tag on Sitemeter shows that about one in three visitors to this site over the past week or so have been hoping to find out how to "get rid of barn swallows," or, more pointedly, "kill barn swallows."
I have written about this before, and my advice has always been to not obsess about the mess, rather, to enjoy the birds. It's summer; there are supposed to be Barn Swallows around. They liven up the place.
In any case, you are not allowed to kill them, anywhere in North America. They are protected by the (international) Migratory Bird Treaty Act.
In addition, like so many Neotropical migrants, in many places they are in decline, which is a worrisome development for many reasons.
I would add, they are the most spectacular fliers of the swallows. Spend some time out in a field with them--they'll make your head spin.