I have a boolean expression which I want to show perhaps in a text box which could be easily copied or modified.

The expression has conditions ( C1, C2 ... Cn ) and boolean operators ( AND, OR ). I have another table showing the attributes of the condition so that is covered and a tree showing the logical hierarchy.

The only thing missing is to give the ability to user to see an expression which is easily copied, edit (bulk) and read easily.

AND ( C1, OR( C5, C6 ), AND( OR ( C2, C3, C4 ), C7, C8, C9))

Any pointers help brainstorming, perhaps a way to visually separate the grouping ? or making the Cn of different font ?


  • But All Any are not boolean operators. en.wikipedia.org/wiki/Boolean_expression. What is an example of a condition? First you need to clearly define the condition and operators. – paparazzo Dec 6 '14 at 20:16
  • conditions are denoted by Cn. example C1 could be x >4 – Abhi Dec 6 '14 at 20:20
  • X > 4 is a boolean expression. Coloring it up is not going to help until it is clearly defined. – paparazzo Dec 6 '14 at 20:28
  • i am not worried about x > 4 that is clearly mapped to C1 .... i am concerned about the expression which i have mentioned above where i am denoting the Cs with AND / Ors – Abhi Dec 7 '14 at 4:32

Among the spreadsheet applications I have used so far, current Apple Numbers has the nicest inline formula editor. It goes beyond mere color-coding. Note how there are no literal parentheses in the screenshot.

Apple Numbers 3 formula editor

Traditional math typesetting (e.g. TeX) increases the size of outer brackets sometimes, which can help with deep nesting, but when editing it is probably more helpful to highlight the current context with color or bold parentheses.

Automatic conversion to canonical forms may bring the most usability benefit, although it has a user experience backlash in that user input is automatically altered, possibly without a way to undo.

AND ( C1, OR( C5, C6 ), AND( OR ( C2, C3, C4 ), C7, C8, C9))

is equivalent to

AND ( C1, C7, C8, C9, OR( C5, C6 ), OR ( C2, C3, C4 ))

which would be written elsewhere something like this:

C1 and C7 and C8 and C9 and (C5 or C6) and (C2 or C3 or C4)

It could be displayed two-dimensionally like this:

  • C1 • C7 • C8 • C9
    • C5
      • C2
      • C3
      • C4
    • C6
      • C2
      • C3
      • C4

… or this:

                    C5   C2
C1 • C7 • C8 • C9 •    • C3
                    C6   C4

I have just recently designed an UI for stripping regular expressions manually, maybe it can help or give you an idea.

enter image description here


What about a tree diagram?

Here's an example from Predicate Logic that may be applicable:

enter image description here

The end nodes in this case are constants, but in your case should be replaces with expressions. Also, PL has more operators.

This is definitely more graspable that just inline bracketed notation.

However, editing will probably have to be inline.

Consider how this webpage handles Linguistic syntax trees:
(Just click "Draw", try messing around with the lowercase text)

You could elaborate on their design by having a click (or double-click?) on a node in the tree highlight the corresponding bracket in the editing text field, for better contextual editing.

  • @Abhi said they already have a “tree showing the logical hierarchy”. – Crissov Dec 9 '14 at 15:44
  • Oh, sorry. I missed that. Anyway, I thibk part of my question still stands - the user can double click a node to focus on it - contextual editing via the easy-to-perceive tree – Navot Dec 9 '14 at 15:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.