What is "code" in "toric code"? When I first heard people talking about using Kitaev's toric code to do topological quantum computation, I was thinking how many lines does the toric code have. Then I was told that
the "code" really represents quantum states. Later,  I understood that the "code"
is the degenerate ground subspace of a gapped Hamiltonian.
But then I was corrected by people from quantum information who pointed out that code is a subspace of the Hilbert space of a quantum system, but code is also more than a subspace. 
So now I am wondering what is "code"?
 A: In general a "code" in quantum information is a collection of "codewords". One takes a (relatively large) number of physical qubits and considers only a limited number of states (i.e. a low-dimensional subspace) out of the full Hilbert space (formally, the code is the subspace). For stabilizer codes, all of these states are ground states of some gapped hamiltonian. Because there is a good deal of redundancy, the system is more robust against errors and decoherence.
Perhaps a clearer example would be the repetition code. Say you have six qubits, but you restrict yourself to the subspace spanned by $$\{|000,000\rangle,|000,111\rangle,|111,000\rangle,|111,111\rangle\}.$$
You can then think of these long combinations as "codewords" for the logical states $$\{|00\rangle,|01\rangle,|10\rangle,|11\rangle\},$$
but they can still be recognized if any given qubit suffers some error.
A: I know this is a very old question, and that Prof. Wen probably doesn't need this answer anymore. Also the answer provided by Steve is correct. However I was only able to understand the answer in hindsight, and I think I can give a simpler answer for what is code in toric code.
I think it's just in analogy with the classical problem of communication over a noisy channel. In this problem, we want to send $k$ bits over a noisy channel and still be able to retrieve the information in those $k$ bits on the other end of the channel. The solution to this problem is to encode the original signal of $k$ bits in $n$ bits, $n>k$. In another words, we add redundancy to the system such that when errors occur, we can still retrieve the original information stored in the those $k$ bits. The study of how efficient this encoding and then decoding process can be is called coding theory. The simplest classical code is maybe the repetition code, where for example $0 \rightarrow 000$ and $1 \rightarrow 111$. And then the decoding process would be a majority vote.

The same problem is really amplified in the quantum world. In particular if we have any hope of performing quantum computations effectively we should have a way of correcting the errors as they happen for the qubits. The solution to this problem really follows the same spirit as in the classical case. That is, suppose we have $k$ qubits that we want to be able to retrieve the information stored in them after errors get introduced to the system. We add redundancy to the system by encoding these $k$ qubits into a bigger space of $n$ qubits. The details of how this can be done is somewhat different than in the classical case, however it shouldn't be surprising that such encoding of $k$ qubits into $n$ qubits is called a quantum code.
The toric code does exactly that. For example on a torus, it encodes 2 qubits as the fourfold ground state degenerate space of a physical model. The model provides the detail of such encoding, and hence it's a quantum code, called the toric code.
A: Let me try to give you the answer in just the right amount of generality. A quantum code is just a short way to say a quantum error-correcting code. It is a special embedding of one vector space into another larger one that satisfies some additional properties. If we start with a Hilbert space $H$, then a code is a decomposition into $H = (A \otimes B) \oplus C$. The quantum information is encoded into system $A$. In the event that $B$ is trivial, then indeed this is just a subspace of $H$. When $B$ is nontrivial, we say call it a subsystem code. Let's specialize to the case of $n$ qubits, so that $H = (\mathbb{C}^2)^{\otimes n}$, and it is easiest to imagine that the dimensions of $A$, $B$, and $C$ are all powers of 2, though of course this discussion could be generalized.
Let $P$ be the orthogonal projector onto $A\otimes B$, and let $\mathcal{E}$ be an arbitrary quantum channel, i.e. a completely positive trace preserving linear map. We say that $\mathcal{E}$ is recoverable if there exists another quantum channel $\mathcal{R}$ such that for all states $\rho_A \otimes \rho_B$, we have 
$$\mathcal{R}\circ\mathcal{E}(\rho_A \otimes \rho_B) = \rho_A \otimes \rho'_B,$$
where $\rho'_B$ is arbitrary. This says that for any state which is supported on $A\otimes B$ and is initially separable, we can reverse the effects of $\mathcal{E}$ up to a change on system $B$. 
Fortunately, there are simpler equivalent conditions that one can check instead. For example, an equivalent condition can be stated in terms of the Kraus operators $E_j$ for the channel $\mathcal{E}$. The subsystem $A$ is correctable for $\mathcal{E}(\rho) = \sum_j E_j \rho E_j^\dagger$ if an only if for all $i,j$, there exists a $g^{ij}_B$ on subsystem $B$ such that
$$ P E_i^\dagger E_j P = 1\hspace{-3pt}\mathrm{l}_A \otimes g^{ij}_B.$$
You can interpret this condition as saying that no error process associated to the channel $\mathcal{E}$ can gain any information about subsystem $A$. 
Consider error channels which consist of Kraus operators that, when expanded in the Pauli basis, only have support on at most $d$ of the $n$ qubits in our Hilbert space. If every such channel is correctable for subsystem $A$, then we say our code has distance $d$. The largest such $d$ is called the distance of the code. For the toric code, this is the linear size of the lattice. 
