Git Product home page Git Product logo

object-finder's Introduction

Object Finder

In a network of computers or objects, each of which provides some useful functionality, how might we describe a particular piece of functionality that we want to use so that a broker may automatically make bindings to an object (or set of objects) that provides it?

One possibility is to give a name each service, like interfaces in Java. But that requires advance planning -- all of the objects / computers have to agree on that name -- and it's inherently anti-modular.

It would be much better if we could somehow describe the behavior of these services in an abstract way, e.g., using something like what Alan Kay calls "semantic types". But we don't have semantic types yet, so as a first approximation, I've done a little experiment in which a service is identified by a spec that consists of a set of unit tests. These unit tests specify the behavior of each of the desired operations, and how they should interact with each other. This builds on Ted Kaehler's method finder; the difference is that in this case we're looking for a whole object, not just one method.

Here's what a spec looks like:

var cryptoSpec = {
  operations: ['encrypt', 'decrypt'],
  test: function() {
    return this.encrypt('hello world') != 'hello world'
        && this.decrypt(this.encrypt('hello world')) == 'hello world';
  }
}

The spec above describes an object that supports two operations, encrypt and decrypt. Note that it doesn't matter what these operations are actually called in the object that provides them -- in the spec, you're specifying what you want to call them and it's up to the system to make that work.

Given a spec and a list of available objects, the "broker" will try to find (sometimes synthesize) an object that satisfies the spec. My current implementation is very naive and clearly would not scale -- for each object that the broker knows about, it tries every possible binding of its methods to the operations in the spec -- but it has been useful to solidify some of my ideas about how such a discovery mechanism might work.

Supporting this kind of discovery is part of a larger goal to enable programmers to build new applications using existing applications or services as building blocks. There are many other interesting aspects of this problem that are worth thinking about, e.g., can we make bindings loosely so that when an object / service goes down, the same functionality can be provided by another object or a combination of objects? And if so, how do we deal with state?

(Our Onward! 2014 paper explores a very different approach to discovery.)

object-finder's People

Contributors

alexwarth avatar chocolateboy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

intensifier

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.