CW complex
From Academic Kids

In topology, a CW complex is a type of topological space introduced by J.H.C. Whitehead to meet the needs of homotopy theory. The idea was to have a class of spaces that was broader than simplicial complexes (we could say now, had better categorical properties); but still retained a combinatorial nature, so that computational considerations were not ignored. The name itself is unrevealing: CW stands for closurefinite weak topology.
For these purposes a closed cell is a topological space homeomorphic to a simplex, or equally a ball (sphere plus interior) or cube in n dimensions. Only the topological nature matters: but one does want to keep track of the subspace on the 'surface' (the sphere that bounds the ball), and its complement, the interior points. A general cell complex would be a topological space X that is covered by cells; or to put it another way, we start with a space that is the disjoint union of some collection of cells, and take X as a quotient space, for some equivalence relation. This is too general a concept.
Contents 
Attaching cells
A cell is attached by gluing a closed ndimensional ball D^{n} to the (n−1)skeleton X_{n−1}, i.e., the union of all lower dimensional cells. The gluing is specified by a continuous function f from ∂D^{n} = S^{n1} to X_{n−1}. The points on the new space are exactly the equivalence classes of points in the disjoint union of the old space and the closed cell D^{n}, the equivalence relation being the transitive closure of x≡f(x). The function f plays an essential role in determining the nature of the newly enlarged complex. For example, if D^{2} is glued onto S^{1} in the usual way, we get D^{2} itself; if f has winding number 2, we get the real projective plane instead.
CW complexes are defined inductively
Assume that X is to be a Hausdorff space: for the purposes of homotopy theory this loses nothing important. Then since closed cells are compact spaces, we can be sure that their images in X are also compact, closed subspaces. From now on, we refer to 'closed cells', and 'open cells', as subspaces of X, the open cell being the image of the distinguished interior.
A 0cell is just a point; if we only have 0cells building up a Hausdorff space, it must be a discrete space. The general CWcomplex definition can proceed by induction, using this as the base case.
The first restriction is the closurefinite one: each closed cell should be covered by a finite union of open cells.
The other restriction is to do with the possibility of having infinitely many cells, of unbounded dimension. The space X will be presented as a limit of subspaces X_{i} for i = 0, 1, 2, 3, … . How do we infer a topological structure for X? This is a colimit, in category theory terms. From the continuity of each mapping X_{i} to X, a closed set in X must have a closed inverse image in each X_{i}; and so must intersect each closed cell in a closed subset. We can turn this round, and say that a subset C of X is by definition closed precisely when the intersection of C with the closed cells in X is always closed.
With all those preliminaries, the definition of CWcomplex runs like this: given X_{0} a discrete space, and inductively constructed subspaces X_{i} obtained from X_{i−1} by attaching some collection of icells, the resulting colimit space X is called a CWcomplex provided it is given the weak topology, and the closurefinite condition is satisfied for its closed cells.
'The' homotopy category
The idea of a homotopy category is to start with a topological space category, that is, one in which objects are topological spaces and morphisms are continuous mappings, and abstractly to replace the sets Mor(X, Y) of morphisms by sets of equivalence classes Hot(X, Y) that are defined by the homotopy relation. So, the objects remain the same; but the morphisms have been gathered into collections. Under favourable conditions Mor(X, Y) is itself a function space and the procedure is to take its set of components under pathconnection as a simpler version: this provides the intuitive picture.
The homotopy category of CW complexes is, in the opinion of some experts, the best if not the only candidate for the homotopy category. In fact, for technical 'administrative' reasons a homotopy category must keep track of basepoints in each space: for example the fundamental group of a connected space is, properly speaking, dependent on the basepoint chosen. A topological space with a distinguished basepoint is called a pointed space. The need to use basepoints has a significant effect on the products (and other limits) appropriate to use. For example, in homotopy theory, the smash product X ∧ Y of spaces X and Y is used.
To a large extent the business of homotopy theory is to describe the homotopy category; in fact it turns out that calculating Hot(X, Y) is hard, as a general problem, and much effort has been put into the most interesting cases, for example where X and Y are spheres (the homotopy groups of spheres).
Auxiliary constructions that yield spaces that are not CW complexes must be used on occasion, but half a century since Whitehead has left this definition of homotopy category in good shape. One basic result is that the representable functors on the homotopy category have a simple characterisation (the Brown representability theorem).
One important later development was that of spectra in homotopy theory, essentially the derived category idea in a form useful for topologists.
Properties
 The product of two CW complexes X and Y is itself a CW complex if at least one of them is locally finite i.e. it has a finite number of cells in each dimension.
 The function spaces Hom(X,Y) are not CWcomplexes in general but are homotopic to CWcomplexes by a theorem of John Milnor (1958). Actual function spaces occur in the somewhat larger category of compactly generated Hausdorff spaces.
References
 Hatcher, Allen, Algebraic topology, Cambridge University Press (2002). ISBN 0521795400. This textbook defines CW complexes in the first chapter and uses them throughout; includes an appendix on the topology of CW complexes. A free electronic version is available on the author's homepage (http://www.math.cornell.edu/~hatcher/).