Home > Net >  Diagramming Decision Trees
Diagramming Decision Trees

Time:11-26

I have been a self-taught coder for a long time, and I am asking for help with a conceptual problem here. I can solve this particular issue myself, but I feel like these problems always take me too long with trial & error solutions. I believe there is a way to Diagram this type of problem, but I don't know what it is called or how to look up this solution.

When I have multiple, often inter-dependent pre-conditions to a conditional outcome like as follows, it takes me forever to figure how to arrange my conditional statements:

I have a set of Values called: "Tab Numbers". Let's say I have 4 pre-conditions:

  1. All Tab Numbers are blank
  2. Some Tab Numbers are blank
  3. A Session Boolean flag called SuppressPrompt is True
  4. This Method is being called during the Open Session Event

These Pre-conditions determine my 3 desired outcomes:

A) Prompt for User Input B) Auto-Populate Tab Numbers C) Do Nothing

Now some of these pre-conditions affect other possible preconditions:

Eg.: The the Flag in Condition #3 cannot be set if the method is being called in the Open Method Condition #4.

I believe there is a good way to diagram these types of problems so that I don't have to puzzle through them with Trial & Error every time. Can anyone help point me to a resource to learn how to do this easier?

I am sorry if I am not posting this in the right place, but it is a problem that I keep running into. If anyone could just help point me in the right direction, I would really appreciate it.

CodePudding user response:

Your truth table may look like this:

    Preconditions                                   Outcomes
AllBlank    SomeBlank   SupPrompt   OpenSession UserInput   AutoFill    Notes
T           T           [T]         T           ?           ?           Impossible
T           T           T           F           ?           ?
...
F           F           F           F           ?           ?

You will hopefully see some non obvious correlations, which will allow you to simplify your table, possibly splitting it, until you get the logical expression(s) you need

  • Related