You really want to write code only once, and compile it to two targets: One for the server, one for the client. This is really hard to do in all current mainstream languages.<p>To illustrate: You have some piece of state y, and you have x = f(y) that means "x is always the value of f(y), when y changes, update x." Furthermore x is shared state across many users. On the server side you want that statement to generate code for synchronizing values of x and y across users. On the client side you want to generate code for pushing and pulling Ajax/Comet updates from the others.