Definition: Let $Z$ be an irreducible closed subset of $X$. Then the codimension $\textrm{codim} (Z,X)$ is the supremum of integers $n$ such that there exists a chain $$ Z = Z_0 < Z_1 < \dots < Z_n$$ of distinct closed irreducible subsets of of $X$.
I want to see that for a ring $A$ and $X = \textrm{Spec } A$, this is equivalent to the definition of heights in commutative algebra, namely,
$$\textrm{ht} (p) = \textrm{codim} (V(p),\textrm{Spec } A )$$ for $p \in \textrm{Spec } A$.
My main issue currently is that I am uncertain of what general irreducible closed subsets of an affine scheme look like.
Any irreducible closed set in $\textrm{Spec}\ A$ is of the form $V(q)$ for a prime ideal $q\subset A$. Consider a chain computing the codimension of $V(p)$ in $\textrm{Spec}A$.
$V(p)=Z_0 < Z_1<...< Z_n$. Note that each $Z_n=V(p_n)$ for some prime ideal $p_n$. The strict inclusion $V(p_i)<V(p_{i+1})$ induces a strict reverse inclusion of ideals $p_{i+1}<p_i$ in the ring $A$.
Hence we get the chain,
$p_n<p_{n-1}<...<p_0=p$. Note that this is also a maximal chain. Hence computes the height of $p$.