TITLE: Types, Sets and Categories
QUESTION [10 upvotes]: I am learning Category Theory and at first I just pictured a category like a class in object oriented programming: type definition + methods (morphisms). However the author I am reading uses maps  like A --f--> B and doesn't tell you if f is going from category A to category B, or if A and B are in the same category. He also uses sets, which is more troublesome if you care for the the meaning of what you are doing.
Questions
How are categories different from sets? And why doesn't every body just use types in the first place?
Note: The second question is a teaser, I study Mathematical Engineering but am also a Developer. In programming languages the notion of type is very well understood, and one of these types is the Set and there is nothing special to it. In math however, the concepts its not only incredibly dominant, it had/has mayor flaws (paradoxes).

REPLY [3 votes]: For start sets are rather different objects from categories in that they are structureless data type, from type theoretic view point sets are just data type with an equality relation.
Categories are a completely different sort of objects, for start they consist of two type of objects (objects and morphisms/arrows) and they have much more structure: there are various operations that relate them.
Of course you can treat categories from a type theoretic perspective, and in such perspective you can reguard a category just as an instance of a specification for an abstract data type.
There are different specifications for a category, one is the following one.
A category $\mathbf C$ is given by:

a type $\mathbf C_0$ whose terms are called objects;
a type $\mathbf C_1$ whose terms are called morphisms;
two operations $s,t \colon \mathbf C_1 \to \mathbf C_0$ which are called source and target respectively;
one operation $i \colon \mathbf C_0 \to \mathbf C_1$ called identity
one partial operation $\circ \colon \mathbf C_1 \times \mathbf C_1 \to \mathbf C_1$ called composition

this data are required to satisfy the following properties:

for every $f,g \in \mathbf C_1$ the composite $\circ(g,f)$ is defined iff and only if $t(f)=s(g)$;
whenevery $f,g,h \in \mathbf C_1$ are morphisms such that $s(h)=t(g)$ and $s(g)=t(f)$ then $h \circ (g \circ f)=(h \circ g) \circ f$ (note that this composite are defined because the previous property);
for every $X \in \mathbf C_0$ and every $f,g  \in \mathbf C_1$ such that $s(f)=X$ and $t(g)=X$ you have that $f \circ i(X)=f$ and $i(X) \circ g=g$.

This specification can be seen from a computer science point of view as an abstract data type, a category is simply an instance of this abstract data type.
Hope this helps.