What's the relation between prime spectrum and affine space? 
Let $A$ be a ring ,$X$ be the set of all prime ideal of $A$.For each subset $E$ of $A$,let $V(E)$ denoted the set of all prime ideals of $A$ which contain $E$.
we have:


*

*$V(0)=X,V(1)=\emptyset$


*$V(\bigcap_{i \in I} E_i)=\bigcup_{i \in I} V(E_i)$


*$V(E)=V(a),\text{if a is the ideal in A generated by}~E$


*$V(ab)=V(a)\bigcup V(b) \text{for any ideals a,b in}~A$

Let $k$ be any field,By $\mathbb{A}^n(k)$,we shall mean the cartesian product of k with itself n times.If $F \in k[x_1,...,x_n]$,the set of zeros of $F$ is called the hyper-surface,and is denoted by $V(F)$.
we have:


*

*$V(0)=\mathbb{A}^n(k),V(1)=\emptyset$


*$V(\bigcap_{\alpha} E_{\alpha})=\bigcup_{\alpha} V(E_{\alpha})$


*$V(S)=V(I),\text{if I is the ideal in k[x_1,...,x_n] generated by }~S$


*$V(PQ)=V(P)\bigcup V(Q) \text{for any  polynomials P,Q in k[x_1,...,x_n]}$

It seem that  prime spectrum and affine space are the same things,
then a polynomial can be regard as an ideal,
Zariski topology can be regard as affine algebraic set.
How to explain the hyper-surface and dimension in the algebraic view?and why they are look like a same thing.

This is really only a partial answer that was too long for a comment but I hope it is helpful.
If you consider the prime spectrum of the ring of regular functions on an affine variety $X$, where by affine we mean the zeros of a collection of polynomials over an algebraically closed field, you almost get back the variety $X$ but not quite.  The maximal spectrum will be the same as $X$ since by the nullstellensatz points in $X$ correspond to maximal ideals in the ring of regular functions on $X$.  But in the prime spectrum you have additional points, which correspond to the irreducible subvarieties of $X$.  These points are not closed, but rather their closure consists exactly of their irreducible subvarieties.  You can think of the prime spectrum of a commutative ring as a generalization of affine varieties, which plays a very important role from the modern perspective of the theory.  
