1 of 28

MSON

Everyone Can Make Software

🏗️

2 of 28

Who am I?

  • Director of Software Architecture at Knock�(we are hiring at knockcrm.com)
  • Creator of Spiegel, a scalable replication layer for CouchDB
  • Creator of Slouch, a JS client for CouchDB
  • Creator of DeltaDB, an offline-first database
  • Creator of MSON Lang

3 of 28

The problem

You still need to write code to solve many problems

4 of 28

teepublic.com

5 of 28

Why can’t creating software be as easy as creating a spreadsheet?

6 of 28

The dream

Everyone can create software visually

7 of 28

First step

Create a language that can be easily manipulated by a UI

8 of 28

Declarative = what

Imperative = how

9 of 28

Imperative

Declarative

let arr = [1, 2, 3, 4, 5, 6];��let result = [];for (let i = 0; i < arr.length; i++) {if (arr[i] % 2 === 0) {� result.push(arr[i]);}}

�console.log(result); // [2, 4, 6]

let arr = [1, 2, 3, 4, 5, 6];

let result =

arr.filter((num) => num % 2 === 0);

console.log(result); // [2, 4, 6]

https://www.slideshare.net/mzupzup/functional-programming-principles-patterns

vs

10 of 28

MSON is a declarative language with the capabilities of an object-oriented language

11 of 28

MSON is a subset of JSON

The MSON compiler is written in JS and is framework agnostic

12 of 28

Declare your components

Let the UI layer automatically render them

13 of 28

What the what?

14 of 28

{� component: 'RecordList', label: 'Contacts',� baseFormFactory: {� component: 'Factory',� product: {� component: 'Form',� fields: [{ name: 'name', component: 'TextField', label: 'Name' }]}},� store: { component: 'LocalStorageStore', storeName: 'contacts' }}

15 of 28

Language Features

  • Components, Validators, Events & Listeners
  • Access Control
  • Inheritance, Template Parameters, Composition & Factories
  • Aggregate Components
  • Schemas and Self Documenting

16 of 28

Components

{� name: 'MyForm',

component: 'Form',� fields: [{ name: 'name', component: 'TextField', label: 'Name', required: true },{ name: 'email', component: 'EmailField', label: 'Email' }]}

17 of 28

Components

18 of 28

Validators

{� name: 'MyForm', component: 'Form',� fields: ...,� validators: [{where: { 'fields.email.value': 'nope@example.com' },� error: {� field: 'email',� error: 'must not be {{fields.email.value}}'}}]}

19 of 28

MongoDB-Style Query

where: {'retypePassword.fields.value': {� $ne: '{{fields.password.value}}'},� error: ...}

20 of 28

Events & Listeners

{� name: 'MyForm', component: 'Form',� fields: ..., validators: ...,� listeners: [{event: 'submit',� actions: [{� component: 'Set', name: 'fields.email.value',value: '{{fields.name.value}}@example.com'}]}]}

21 of 28

Conditional Actions

actions: [{� component: 'Set',if: {'fields.email': {� $or: [{ value: null }, { value: ''}]}},� name: 'fields.email.value',value: '{{fields.name.value}}@example.com'}]

22 of 28

Access Control

access: {� form: {� create: ['admin', 'manager'], read: ['admin', 'employee'],� update: ['admin', 'owner', 'manager'], archive: 'admin'},� fields: {� name: {� create: 'admin', update: 'owner'}}}

23 of 28

Inheritance

{� name: 'MyFormExtended',component: 'MyForm',� fields: [{� name: 'phone',� component: 'PhoneField',� label: 'Phone Number',� before: 'submit'}]}

24 of 28

Template Parameters

{� name: 'MyTemplatedForm',� component: 'Form',� fields: ['{{firstField}}',{� name: 'secondField',� label: '{{secondFieldLabel}}',� component: 'EmailField'}]}

{� name: 'MyFilledTemplatedForm',� component: 'MyTemplatedForm',� firstField: {� name: 'firstName',� component: 'TextField',� label: 'First Name'},� secondFieldLabel: 'Email Address'}

25 of 28

Schemas & Self Documenting

{� name: 'MyComponent', component: 'Component',� schema: {� component: 'Form',� fields: [{� name: 'hidden', component: 'BooleanField',� help: 'Whether or not the component is hidden'}, {� name: 'updatedAt', component: 'DateField', required: true,� help: 'When the component was updated'}]}}

26 of 28

Autogenerate forms for React and MaterialUI

27 of 28

TODO

Create a UI that can build any app

28 of 28

MSON

🏗️