Using a code repository such as CVS, SVN, Mercurial, Git etc you can easily work on the same code at the same time.
My preference at the moment is SVN or Subversion as its called. What happens is you write your code and then commit it to the repository, then the other developer(s) can synchronize against the repository and update their code.
Have a look at the following:
CVS - Open Source Version Control
Git - Fast Version Control System
There are probably more Source Control Management systems but that should give you a good start.