Liberty IoT App is Anti-Visual Programming

4 minute read

The development of Liberty IoT App is often categorized as “Visual Programming”. That, is not our system is designed for.

More precisely, our system is rather designed for “anti-visual programming”.

Why Visual Programming?

For those who design various “Visual Programing” tools for end users, they need to answer two serious questions:

  1. How do you do programming? With your keyboard or with a mouse, or even worse, on a tiny touch screen?
  2. If visual programming is so good, why don’t you use visual programming tools to do your daily programming work? If you don’t think visual programming is any good, why do you want your users to use it?

And most importantly, for smart home system, our end users are NOT programmers!

Anti-visual Programing is Data Editing!

With Anti-Visual Programming, end-users only need to edit some data.

The data is MINIMUM amount of data required to change the behavior the program!

Users don’t do programming. Programming is done by developers. A nice and clean separation of roles!

An Example - Blinking Light Bulbs (Light Show)

Here is a “simple” example, creating a light show with arbitrary number of lights.

For example, with 2 lights A and B:

Blinking Together with 1 Second Interval:

  • A on; B on
  • Wait for 1 second
  • A off; B off
  • Wait for 1 second
  • Repeat the above pattern forever

Blinking Alternatively with 1 Second Interval:

  • A on; B off
  • Wait for 1 second
  • A off; B on
  • Wait for 1 second
  • Repeat the above pattern forever

The Solution

  • User can divide arbitrary number of lights into many sub-groups
  • State of lights (level) within same sub-group are set all at once (at the same time)
  • Each sub-group has a “wait” parameter that represents delay (seconds) before processing next sub-group

The Data

The data structure that drives “Light Show” process is not very simple.

Data

  • Each sub-group of lights is an array (List).
  • The group of sub-group is another array (List).
    The data structure is a nested structure with “outer” and “inner” arrays.
  • Each sub-group has a delay parameter “wait”.
    We need to wrap sub-group and “wait” with a struct (Table).
  • Finally, the level of each light in sub-group can be controlled individually, so light and “Level” also forms a struct (Table).

Overall, the input data is a tree structure, the definition of the data structure is also a tree structure.

Our development tool, “Liberty-IoT Studio”, provides a GUI tool that helps developers to define the input data structure, which is called “Signature Editor”.

What Does the End User See?

End users can simple create tasks of “Light Show” App, from their Smartphones.

It takes users one click can add a new item into array.

For outer array, touch “Add Light Group” to add a new “Light Group”.

For inner arrays, touch “Add Light & Level” to add a new light (with custom Level) into the light group.

It is trivial for users to manipulate the arrays, e.g. removing elements from array or rearrange order of elements.

UI

This the universal data UI on smartphone. The UI is automatically generated based on the structure definition of data structure (the signature).

The Code

With a fairly complex input data structure, the code is surprising simple.

It is only 10 lines of code!

function MyLightShow(groups)
  while true do
    -- groups is a list of control group
    for _, group in ipairs(groups) do
      for _, lightState in ipairs(group.lightStates) do
        Libre_DeviceLevelSet(lightState.light, lightState.onLevel)
      end
      Libre_Wait(group.wait * 1000)
    end		
  end
end

Deep Integration into Liberty-IoT OS

In Liberty-IoT OS, function entry is task process entry point.

Data is just input arguments of function.

Optimal Design, Mathematically Provable

This design can be proved to be optimal for all parties.

Logically Complete, Thus Maximum Flexibility

Because the App Developer can freely write the code, our machine can be proved to be equivalent to a Turing Machine, by reduction.

It mean our machine is logically complete.

In contrast, all other IoT platforms can’t even effectively blink a couple of lights. It is not really about blinking lights. It means that their system is NOT “logically complete”. Mathematically they lack unlimited amount of capabilities, which will become a myth to end users.

Minimum Cost for End Users, Optimal User Experience

Because end users are only required to provide minimum amount data to change the behavior of the program (the App), this designed is optimal of end users’ experience.

Simply because it can’t be simpler!

Maximum Reusability, Great for App Developers

The design provides two kinds of separations:

  1. Separation between developer role and end-user role
  2. Separation between code and data

That, results in maximum software reusability and optimal App architecture.

Translation

Maximum reusability leads to maximum sharing capability.

Even the localized translated can be crowd-sourced and shared with the whole world.

Below is a contribution of Chinese translation of the “Light Show” App, along with the look-and-feel on Smartphone.

Chinese

Chinese

Optimizations

I designed many optimizations in data modeling that vastly improved end-users experience, security and privacy protection.

For more information, read “Attributes”.

Another Example - Thermostat Schedule App

Thermostat

Another Nice Diagram

App

Leave a comment