SCFFLD: Internal URIs, functions and microservices

SCFFLD provides a powerful internal URI system which allows different parts of the app to be referenced using strings conforming to a standard URI format. Here, a "part" of the app can be literally anything contained within the app - JSON data, an image file, an object implementing a service, a screen representing a part of the UI, an object representing an event etc etc. The URIs supported by the system can be used to address an internal space populated by the data, objects, files and other resources that make up the running app.

A distinction needs to be made between internally addressable resources and external resources, located on the network and referenced using standard web URLs. Internal resources are expected to be available at all times, and capable of being resolved to a value with minimum delay. This means that they can be accessed synchronously. On the other hand, external resources located on the web may not be accessible (because, for example, the network is not available, or the server is down); and even when accessible, significant delays may be involved when resolving a value from the resource due to network latency etc. For this reason, access to web resources is often best performed using asynchronous methods, so that other work can be performed while waiting for a response.

URI parameters

The SCFFLD internal URI system uses a compound URI format which allows parameter values on a URI to be specified as nested URIs. This is a powerful feature that allows URIs to describe compound objects whose properties are in turn described using nested URIs. A typical example of this is a URI addressing a web view which loads its content from an HTML file:


It can be seen that there is a direct relationship between this kind of URI and a SCFFLD JSON configuration describing the same view:

    "-type":    "WebView",
    "content": "@app:/assets/main.html"

URIs as functions

Internal URIs in SCFFLD can be thought of as functions in a functional programming language. Resolving a URI to its value is like calling a function that returns a value; resolving the URI app:/assets/main.html is like calling a function that reads the contents of the file assets/main.html from the app filesystem. URIs with parameters are like functions with arguments, and compound URIs are like function calls whose arguments are the results of nested function calls.

URIs as microservices

The internal URI space in SCFFLD provides many of the benefits associated with microservices. It naturally allows loose coupling of components within an app, with component inter-dependencies specified using URI references in SCFFLD configurations rather than being written in code. The services offered by different components are all accessed through a standard interface - i.e. the compound URI format and URI dispatch calls in the SDK. Objects representing addressable resources can be designed and implemented around specific, core capabilities, keeping their implementation as concise and simple as possible.