We compare or contrast two items in order to understand how one thing is like another, or how one thing is different from another.
While we can use comparison (showing how two things have similar qualities) and contrast (showing how two things have opposing qualities) in the same essay, it is easier in a short essay to do one or the other.
Purpose is also extremely important in comparing or contrasting.  In general, we either want to explain two things two our audience, or we want to persuade them that one thing is better than the other.
Many times, one item is known to our audience while the other is not. Our purpose is to explain the unknown item in terms of the known item.
Comparison and Contrast