Skip to content
This repository

What is a system?

For the purpose of ’’Interface’’ system is a contained structure of interfaces and API’s that do not wish to expose private data that may be shared amongst each other to sources outside of the system. Another attribute of a system is that systems can access internal apis amongs multiple system interface construction layers. By having both of these features one can extend private data by creating new layers of a system without having to modify the original source code of the system, and may instead use a new layer in order to augment it as they please.

Since a system is built upon layers, it is easy to add and remove features by just adding and removing layers from the constructor. For example if one were to build a messaging application one might support a system with and Irc layer and a Jabber layer ie:

    System([Irc,Jabber])

If one wished to add a MSN layer they might do so by creating an interface and using adding it to the system with:

    System([Irc,Jabber,MSN])

If one then wished to remove Irc support:

    System([Jabber,MSN])

If one were to have a multitude of implementations and features they may wish to expose a separate API to allow them to manage the system better:

    function FilteredSystem(features){
            return System(MyLayers.filter(function(layer){
              layer.hasFeatures(features)
            }))
          }

By having each interface self contained it allows for flexibility in choosing which layers are active.

If one wanted to make an interface with standard javascript, it would be hard to do so while not exposing private variables that were added through extension. The access to the construction closure (or object within) that is most often used to create private variables is not available without a reference. By using a system that is well defined we can share the closure between construction layers, kind of like having a friend class in C++.

Advanced Application

  • Systems can be nested (some simple checks can even prevent this possibilty)
  • Systems can be used to hot-swap implementations of an interface to an API (multiple DOM implementations for example)
Something went wrong with that request. Please try again.