Graphically presenting Boolean expressions?

KDE's UI libraries take some more getting used to than GTK, but once you've got the hang of them it rapidly becomes apparent that they form a much more powerful system, both in terms of features and in terms of structures. (This is, I suspect, particularly true for those of us who are native C++ speakers.)

The plotting widget is finally, I'm happy to report, working. Now the immediate challenge is to get the UI design right as the engine that drives the robot coalesces.

The UI has three primary functions: One is to record and display data which are coming back off the robot as it runs, one is to allow biologists to easily alter certain settings to see how that changes the robot's motion, and one is a placeholder because I probably forgot a function. The second function is the one I'm currently interested in -- it is necessary to change certain conditions which, when met, trigger a behavior pattern in the robotic leg.

The problem is that these conditions may be somewhat more complex than a simple "alpha > 25" -- they can actually be full Boolean expressions of the form "(x = true AND alpha > 25) OR beta < 16". It's unlikely that they would ever grow overly complex, but the uncertain morphology of the expressions presents a certain problem in terms of interface, if I end up being required to present the and/or relationships between clauses.

The simple and obvious solution is to present the user with a textbox and allow him or her to enter a Boolean expression. However, this introduces every programmer's nightmare -- verification of user input -- and means we could end up with Boolean expressions of arbitrary length, which the engine authors would like to avoid.

The next solution that occurs to me, being a computer scientist, is to present the expression as a tree. Computer scientists like to represent things as trees. Mathematical and Boolean expressions can be represented thusly:

-Operator
|
-----Operand
-----Operand

And, of course, an operand can be a subtree of its own, consisting of another expression. This could be presented in a tree-view widget, similar to the displays used for the directory structure on your hard drive. There are many advantages to be had here: Clean presentation, simple navigation, and even the ability to let the user add and delete clauses from the expression within constraints of my choice.

The problem, of course, is that while computer scientists like trees, I think it's fairly unlikely that biologists are terribly familiar or comfortable with this representation of such expressions. Which leaves me looking for another way to represent Boolean expressions in a graphical UI. Suggestions welcome, particularly if they involve standard widgets.

Trackbacks

Trackback URL for this entry is: http://blog.case.edu/maw33/mt-tb.cgi/2157

Comments

Post a comment