As the above close-up of cactus spines shows, some plants defend themselves against plant-eaters with spines. In certain arid ranchlands I've seen ranchers use army flame-throwers to burn the spines from wild cacti so cattle could eat them. Since the cattle then ate the cacti with gusto, it's clear that nothing but the spines had kept the cacti from being eaten before!
Similarly, the thistle at the right, Cirsium horridulum, which stands about shoulder high and bears very sharp, stiff spines that can prick you through regular gloves or your jeans, is a classic example of a plant that protects itself with spines. Well, if you were a cow or horse wanting a meal, would you bite into such a plant? Thistles are very common in many disturbed areas. This one grew in a field right next to my home in Mississippi.
Not all spiny plants are as spiny as thistles. For example, the American Holly tree (Ilex opaca) bears only a few spines on its leaf margins, as shown at the left. Why would a tree want spines only on its leaf margins? Think about the problems a caterpillar has finding a place to begin eating. It can't begin in the middle of a leaf, because it can't open its mouth wide enough to get a good first bite -- just like your problem when trying to bite into an especially big apple. The best place to begin eating a leaf (or a pie) is at its edge. This holly leaf, then, is making it uncomfortable for any critter looking for an easy way to begin eating it.
The Dewberry (genus Rubus) at the right bears slender spines along its stem as well as on the petioles of the plant's compound leaves. Dewberries grow in dense thickets, so just imagine how scratched up you get trying to get in a position to eat some leaves -- or pick some of those delicious berries!