Quick start: Hello world!
Our goal with Hapsah.org is to allow anyone who can read and write to create apps by writing (controlled) human language text. This sounds like the holy grail for software engineering. So what does this look like? In this blog I will show you using a (sort of) hello world example: we want to send a personalized greeting message to any new person that is created.
You can create a Hapsah app in just 6 steps divided into 2 parts. In part 1 we will create a “static” app that allows for data entry, but nothing else. Part 2 will show you how to add smart logic to you app by creating active rules.
Part 1: Create a static app
In three steps we will create an app that allows you to create persons (with first names) and greetings (with messages). We will not get into writing the rule for automated personalized greeting message creation just yet.
Step 1: Define nouns
With nouns you can define entities (things of importance) and their attributes (characteristics). In this case we need to define two entities:
1. A Person is a human being.
2. A Greeting is a word or gesture of welcome or salutation.
And we need to define two attributes:
1. A First name is a first of the names that were given to someone when they were born.
2. A Message is a usually short communication transmitted by words, signals, or other means from one person, station, or group to another.
Step 2: Define verbs
With verbs you can define the relationships with which Entities and Attributes can be connected via Statements (explained in step 3). In this case we need to define three verbs.
First, a verb to connect Person with First name:
is referred to by is to mention someone or something in speech or in writing.
Second, a verb to connect Greeting with Message:
contains is to have within; hold.
Third, a verb to connect Person with Greeting:
receive is to be given, presented with, or paid (something).
Step 3: Write statements
In order to actually connect our nouns via verbs we will have to write three statements that generally apply:
1. Persons are referred to by First names
2. Greetings contain Messages
3. Persons receive Greetings
After finishing step 1 to 3 you already have a working app available. With this app you can create a Person with a First name and a Greeting with a Message manually. But we want the latter to happen automatically; we want to make our app smart. For this we need to define a rule. So let’s get to it!
Part 2: Make your app intelligent
In this part we will write a business rule that will create a personalized greeting message for each new person that is added to the app.
Step 4: Write a rule condition
The first thing we need to do is think about when a rule should be executed. In this case:
When Person1 is referred to by First name.
Step 5: Write a rule operation
Then we need to define which data manipulation is to be performed, in this case:
Determine (Hello [joined with] First name that Person1 is referred to by).
Step 6: Write rule actions
As a last step we have to take is to define the actual data creation actions the rule will execute. For this app we need to define three actions:
1. Create Greeting1
2. Assign (Hello [joined with] First name that Person1 is referred to by) to Greeting1 as the Message it contains
3. Make Person1 receive Greeting1
That is it! Now if you create a new Person with a First name, the app will create a personalized greeting message.
If you want to know more about the Hapsah language, please check out our tutorials.