TITLE: Why don't we take clopen maps as morphisms of the category of topological spaces?
QUESTION [12 upvotes]: Here, by clopen maps I mean a function mapping an open set into an open set and a closed set into a closed set. We say continuous maps are the morphisms of the category of the topological spaces. But isn't it more natural to consider clopen maps instead of continuous maps? For example, we say group homomorphisms are the morphisms, and a group homomorphism $h:G\rightarrow H$ preserves the group structure of "$G$" in "$H$". On the other hand, in some sense, a continuous map $f:X\rightarrow Y$ preserve the topological structure of "$Y$" in "$X$". The direction is reversed. I am wondering if there is any good explanation for this. Thanks!

REPLY [6 votes]: We construct a category Top whose arrows are the continuous functions because we are interested in studying continuous functions.
The structuralist philosophy is that "the structure of being a topological space" is precisely the same thing as "being an object of Top".
We can recover the usual description of a topological space (up to natural bijection of sets) from the category structure of Top. Let $1$ be the one-point set, $S$ be the Sierpinski space, and $u : 1 \to S$ be the continuous whose image is the open point of $S$.

The set of points of an object $X$ is (naturally isomorphic to) $\hom(1, X)$
The set of open sets of an object $X$ is (naturally isomorphic to) $\hom(X, S)$
A point $f : 1 \to X$ lies in an open set $g : X \to S$ iff $g \circ f = u$

(note that $1$, $S$, and $u$, can also be identified from the category structure)
So, the "set of points" is a covariant functor and the "set of open sets" is a contravariant functor — we really should expect a 'structure preserving map' to act backwards on the open sets.

It is of interest to note that $\mathbf{Set}^\text{op}$, the opposite category to sets, is equivalent to the category of complete atomic boolean algebras (and join/meet preserving lattice homomorphisms) — the equivalence is given by sending a set $X$ with its power set $\mathcal{P}(X)$.
Since a lot of our intuition about objects comes from sets, this suggests a general principle

The 'covariant structure' on objects looks like operations on points
The 'contravariant structure' on objects looks like operations on subsets

Your examples from universal algebra are all expressed in terms of operations on points, which is why you only see homomorphisms being required to preserve the covariant structure.
For an algebraic example with important contravariant structure, there is the category of local rings and local homomorphisms.
In this category, the unique maximal ideal is an important part of the structure of an object — and, as one might expect, a ring homomorphism $f : R \to S$ is a local homomorphism if and only if $f^{-1}(\mathfrak{m}_S) = \mathfrak{m}_R$.
(Note that the definition is often presented in the equivalent form $f(\mathfrak{m}_R) \subseteq \mathfrak{m}_S$, but I find that much less intuitive and harder to remember)