The title of this blog references a common pattern in learning, from a programming perspective. For example, when you learned basic geometry, you were probably taught some variation of this statement:
Every square is a rectangle, but not every rectangle is a square.
At first it might seem to be a deliberate brain teaser, the kind of thing a person only says to sound smart (they might also throw out words like “antimetabole”.) Geometrically, of course, it’s completely true: if a rectangle is a four-sided figure with four right angles, then a square is just a special type of rectangle. What makes a square special is that all its sides have the same length. And the way the above statement is constructed places the focus squarely on that specialness.
Taking a step back, we can see that this kind of statement is important to the way we learn. At least as far back as Aristotle, people recognized that categorization was a crucial way of understanding the world. We examine each new fact and try to fit it in with the experiences and frameworks we have already built up in our minds. In a search for order and meaning, we try to categorize and classify everything. And often we come across important relationships between things that are similar but different. Or, as in the example above, we find subcategory relationships.
I’ve found that statements of this form continually recur in computer programming. More examples:
- In C, every string is a pointer, but not every pointer is a string.
- In databases, every clustered key is an index, but not every index is a clustered key.
- In networking, every TCP packet is an IP packet, but not every IP packet is a TCP packet.
These are somewhat contrived and obvious, but they illustrate the point: subcategory relationships between similar but different concepts can be a powerful tool to help you learn.
What other subcategory relationships have you found helpful to understand in programming? Can you think of some other antimetabole statements that make them easier to remember?