

LinkJS: Communicate between modules using HTTP-style requests. - pfraze
https://github.com/pfraze/linkjs

======
Animus7
Aren't serialization/deserialization, sanitization and async concurrency
management the most complicated and error-prone parts of JS development?

I don't see any reason to put this stuff back into module interfaces when we
already have module.exports -- and we can already use http.createServer on
localhost if we want a ( _real_ , externally-compatible) HTTP interface to a
module.

------
blibble
just seems like unnecessary serialisation and complexity when you could just
define an interface to some functions?

~~~
pfraze
There are a couple of choices in the framework which need to be tested at a
larger scale, but I felt the linkshui[0] application had reached a point that
it was worth sharing.

The unified interface is meant to allow code to hide behind codified
intentions: the requests. If a module makes a request to a configured URI, it
encodes enough information in the request that any piece of code could step in
to fulfill it.

This is the case in the *nix command line as well; you can compose command
sequences which could be handled by whatever program is referred to.

The browser, however, doesn't really have an exchange system like that. It's
up to the applications to specify how things are corralled, and that's why we
have stuff like Backbone.js. Link is trying a different approach that focuses
more on the operations level, abstracting the exchange between code so they
can live independently.

[0] <https://github.com/pfraze/linkshui>

~~~
blibble
there's already a method for abstracting exchange between code: the function.

unix uses pipes to pass data between processes in different address spaces,
your JS runs in the same address space as the calling JS.

if the processes exist in the same address space you use a library, which is
an implementation of a defined set of functions (which is itself an
interface); this is flat out better as it requires no tedious, error prone
serialisation.

~~~
pfraze
Functions are very simple maps to functionality; they only act as name-tags.
Link's requests share an API for functional descriptions which are mostly
"name," "verb," and "content-type." That enforces a structure that's
recognizable and specific.

So LinkJS is dependency injection. It makes it possible to configure code into
the application.

