When we reached the point to develop user defined actions and filters our interface designer Michael hung. He was thoughtfully staring at the window and smoking one after another, from time to time he started thrashing the punching bag shouting something obscene. Actually, he had non-trivial task: at the last planning meeting it was stated that forcing users create rules in plaintext manner is not user-friendly and non-intuitive.
When the third day came, Michael shouted: "Bingo! We’ll have a tree!" The idea was quite simple: display a logical rule as a tree where brunches represent logical "and" or "or" and leaves represent some logical conditions. The command liked the idea, and he started "creating". For several days he stared at monitor knocking keyboard muttering something obscene. Once he asked me how we were going to store the tree, I was deep in optimizing SQL-queries and said without actual thinking: "In the string, of course."
And finally I was staring at this:
&( s_!=~( city , " Saint- " ) , s_=( platform , " Linux " ) , i_>( screenw , 1024 ) , i_>( screenh , 800 ) , |( i_>( viewed , 7 ) , i_>=( timeonsite , 30 ) ) )
Representing the following tree:
After having look at this string, I told myself: "It looks like a program directive." So, some experiments and test were done and it was found out to be reasonable just to make an interpreter for this language. We’ve called it "scisp" at a very start because of many brackets, but after some thinking we decide that it deals more with logic than with lists, and the language got it final name "SCLOG."
Now SCLOG has two data types ("string" and "integer"), two logical operations ("and" and "or") , four string comparisons ("equal", "not equal", "contains", "not contains"), six integer comparisons ("equal", "not equal", "less", "greater", "less or equal", "greater or equal"), visual tree-building tool written with jQuery for web and php-interpreter.
The string shown upper, has the following form:
&(!~(city,"Saint-"),=(platform ,"Linux"),>(screenw,1024),>(screenh,800),|(>(viewed,7),>=(timeonsite,30)))
Useless spaces gone and operators got more reasonable representations, and the tree visual representation evaluated to the following completely editable with CSS:
What's next:
- New data types: boolean, datetime, float and arrays;
- C# interpreter.
Links: