Motoko, a programming language for building directly on the internet
IMO, the next step for distributed programming, and one web assembly could finally enable, will be communicating with code, not messages.<p>Imagine you&#x27;re building an app that lets users of a music streaming service see how much time they spent listening to particular genres of music.<p>The way you would do this with REST, SOAP or similar could roughly be:<p>1. Retrieve the user&#x27;s whole listen history.<p>2. For each track, send a request to get the track info, which includes album and duration.<p>3. For each album, retrieve the album info, which contains the genre.<p>4. Tabulate the returned data.<p>That&#x27;s thousands of requests, and a lot of network bandwidth wasted.<p>GraphQL is a bit better, you only receive what you need, and you send just one request, but you still get a whole lot of track objects, which need to go through the network and be processed on your side.<p>With my proposed approach, you would send a piece of wasm code, a bit similar to a Lambda function, which would run on the streaming service&#x27;s API cloud.<p>Such a function could use fine-grained API calls to retrieve what it needs. It would be executing on the service&#x27;s network, so round trips would be either short or  nonexistent. After tabulating the data, it would send back a simple JSON with the genres and time spent.<p>This approach would allow developers to extend any service in ways the original developers have never imagined. We could also re-think the way backends and frontends communicate, giving frontend devs a way to do even more, without changing the back end.