"Dirty" proof that Eilenberg-MacLane spaces represent cohomology? The standard approach to proving that $H^n(X; G)$ is represented by $K(G, n)$ seems to be to prove that $\text{Hom}(X, K(G, n))$ defines a cohomology theory and then use Eilenberg-Steenrod uniqueness. This is utterly spiffing, but as far as I can see gives little geometric intuition. In his treatment, Hatcher mentions that there is a more direct cell-by-cell proof, albeit a somewhat messy and tedious one. I haven't been able to find any such proof, but I'd really like to see one; I think it would help me solidify my mental picture of Eilenberg-MacLane spaces. Does anyone have a reference?
 A: I'd suggest looking up some basic material on obstruction theory.  There, you generally find classification of maps $X \to Y$ with domain a CW-complex in terms of cohomology groups $H^s(X;\pi_t(Y))$.  The proofs are often very cellular indeed.
In the case where the range is an Eilenberg-Maclane space (for an abelian group), the dirty proof is something like:


*

*Any map from $X$ is homotopic to one where the (n-1)-skeleton $X^{(n-1)}$ maps to the basepoint of $Y$.

*A map on the n-skeleton $X^{(n)}$ sending the (n-1)-skeleton to the basepoint is determined, up to homotopy, by a choice of element of $G$ for each n-cell of $X$, essentially by definition of homotopy.  This is an element in the n'th CW-chain group $C^n_{CW}(X;G)$.

*Such a map extends to all higher skeleta if and only if the attaching maps for all the (n+1)-cells become nullhomotopic in $Y$.  Thus the map extends if and only if it's represented by a cocycle, i.e. an element of $Z^n_{CW}(X;G)$.

*This is a complete invariant, up to homotopy, of maps that are trivial on the (n-1)-skeleton.  (Higher cells have basically unique maps up to homotopy.)

*Any homotopy between two such maps can be pushed to a homotopy that's trivial on the (n-2)-skeleton of $X$.

*Such a homotopy is determined, up to a "track" (a homotopy between homotopies), by a choice of element of $G$ for each (n-1)-cell of $X$.

*Such a homotopy alters the map on the n-skeleton (as an element of $C^n_{CW}(X;G)$) by adding a coboundary element, something in $B^n_{CW}(X;G)$.

*Therefore, the full mapping space mod homotopy is $H^n_{CW}(X;G)$.


This is a little messy.  Often it's nice to use the filtration of $X$ by subcomplexes $X^{(n)}$ and use that each inclusion in the filtration induces a fibration of mapping spaces
$$F(X^{(n)}/X^{(n-1)},Y) \to F(X^{(n)},Y) \to F(X^{(n-1)},Y)$$
to clean this homotopical analysis up a little into something slightly more systematic.  This leads to a spectral sequence for the homotopy groups of the mapping spaces in terms of the cohomology of $X$ with coefficients in the homotopy groups of $Y$, but you have to be a little careful because there is a "fringe" that exhibits some non-abelian-group-like behavior.
A: I think that a nice write up can be found in the first chapter of Mosher and Tangora (a very nice book).
A: I don't know a reference, but here's an outline.
Step 1. Using the triviality of $\pi_k(K(G, n))$ for $k\ne n$, show that 
(a) any map from $X$ to $K(G, n)$ is homotopic to one where the $(n-1)$-skeleton of $X$ goes to the base point of $K(G, n)$;
(b) such a map determines a function ($n$-cochain) $f$ from the $n$-cells of $X$ to $G$; 
(c) $f$ above is necessarily a cocycle (because the map extends over $(n+1)$-cells); and
(d) two such maps are homotopic if (but not only if) the functions $f$ above agree.
Step 2. Similarly, a homotopy between two maps of the above form determines a function ($(n-1)$-cochain) $g$ from the $(n-1)$-cells of $X$ to $G$.
Step 3. Observe that if a homotopy with corresponding map $g$ which connects maps corresponding to $f_1$ and $f_2$ must satisfy $\delta g + f_2 - f_1 = 0$.  Thus the homotopy classes of maps to $K(G, n)$ correspond bijectively with cocycles mod coboundaries.
