June 2017

Most programs that let one computer talk to another require a protocol: an agreement on how the two computers, the client and the server, will work together. This agreement is made ahead of time. If someday the client asks the server to do something that wasn't in the agreement, the server doesn't do it. Doing something new needs a new agreement.

The problem with this is that it takes a long time to prepare. You have to wait for the new agreement to be drafted, and then wait until the code that does it gets written for the server, and then wait again until the server gets upgraded to run it. And that's if you manage to get the people who use the computers to agree at all.

I think there might be a faster way. To let the client send the code.

Clients could build new protocols without waiting. As long as there's a basic protocol that sends data from one computer to another — like TCP/IP, which we've had for decades — the basic protocol can be used to bootstrap an advanced one: a protocol that can change itself live. [1]

Separating computers in multiple roles and calling some of them clients and some servers isn't necessary either. If there are any roles they depend on the protocol, and perhaps the resources of each computer. Computers can be peers without servers.

I see clients could build protocols without waiting. And I know peer to peer computing is possible because it's becoming more common. Why aren't live protocol updates more common then?

One problem is that it's hard to secure the server. Who knows what the code sent by the client will do? If a client sends code to the server that wipes out the hard drive it'll cause a lot of grief. So some safety checks must be in place.

I can also imagine a second problem. That it'd be hard for programmers to think about live protocol updates. It's easier if the programmer doesn't have to think too much. So any feature that simplifies how network protocols are written or changed would be a good thing to have. I didn't look at this enough, but it reminded me of how easier it is to write web apps with continuations. Could the code that runs in the server be a closure written in the client? Could free variables bound in the client be used across servers?

It's good to know that programming the network without a protocol can be broken into two subproblems. There are solutions to both.


[1]  A couple of years later I found an implementation of this idea.