The deformed relativistic Hartree theory (DRH) is solved both in coordinate
space (DRH-c) and in harmonic oscillator basis (DRH-o). Results obtained f
rom these two methods are compared in details. The DRH-c and DRH-o calculat
ions give similar total binding energies, deformation, level structures and
radii for nitrogen isotopes, while their descriptions on the density distr
ibutions for drip-line nuclei are very different. The large spatial distrib
utions of nucleon densities, which is crucial to understand a weakly bound
system, can only be obtained by DRH-c calculations. This implies that the D
RH theory should be solved in coordinate space in order to describe nuclei
close to the drip line.