Should client-server code be written in one "project" or two?

Posted by Ricket on Stack Overflow See other posts from Stack Overflow or by Ricket
Published on 2010-03-25T15:19:20Z Indexed on 2010/03/25 15:23 UTC
Read the original article Hit count: 285

I've been beginning a client-server application. At first I naturally created two projects in Eclipse, two source control repositories, etc. But I'm quickly seeing that there is a bit of shared code between the two that would probably benefit to sharing instead of copying.

In addition, I've been learning and trying test-driven development, and it seems to me that it would be easier to test based on real client components rather than having to set up a huge amount of code just to mock something, when the code is probably mostly in the client.

My biggest concern in merging the client and server is of security; how do I ensure that the server pieces of the code do not reach an user's computer?

So especially if you are writing client-server applications yourself (and especially in Java, though this can turn into a language-agnostic question if you'd like to share your experience with this in other languages), what sort of separation do you keep between your client and server code? Are they just in different packages/namespaces or completely different binaries using shared libraries, or something else entirely? How do you test the code together and yet ship separately?

© Stack Overflow or respective owner

Related posts about client-server

Related posts about language-agnostic