How to use Decision Tables to help your application
Asked Answered
D

5

7

I learned some time ago about Decision Trees and Decision tables. I feel that Decision Tables can help with conditional If-Then-Else statements. In particular, I feel that Decision Tables have no side-effects, for example, if you didn't notice that you need one more "else if" statement.

But I am not sure how I can implement it. Arrays? Database Tables? Does anyone even use Decision Tables in their code, nowadays?

Drabble answered 22/9, 2008 at 19:20 Comment(0)
K
1

I would highly recommend chapter 18 of Code Complete.

You could also check this post What Are Table Driven Methods

Kachine answered 22/9, 2008 at 19:30 Comment(0)
D
1

Well, I did my own research :S

  1. This is something from IBM about decision tables used to make testing scenarios
  2. This is from a company that makes decision tables that are then translated to if-then-else statements in vb.net.
  3. Open source ruby workflow and bpm engine that uses decision tables.

So, I am still looking. If anyone has some good answers, please enter them in.

Drabble answered 22/9, 2008 at 23:6 Comment(0)
D
1

Multi-platform, CCIDE-0.5.0-6 (or later) is available at SourceForge and Github.

See the web page at http://twysf.users.sourceforge.net/

Dipterocarpaceous answered 2/7, 2012 at 17:59 Comment(0)
D
0

A table-driven method uses data structures instead of if-then statements to drive program logic. For example, if you are processing two types of records (tv versus cable) you might do this:

hash[tv] = processTvRecords

hash[cable] = processCableRecords

In some languages, like Ruby or Perl, this technique is straightforward. In Java, you'd need to use Reflection to find method handles.

If you want to learn about decision tables, investiagethe Fitnesse testing framework at http://fitnesse.org/.

Decortication answered 23/9, 2008 at 0:53 Comment(0)
A
0

By far the best implementation I've seen for decision tables is an application called Prologa, which is available for download at http://www.econ.kuleuven.be/prologa. Unfortunately, it's only available in Windows, and there can be a short delay while you wait for the evaluation key.

The software handles conditions that are non-binary, can collapse similar rules, and actually tracks the number of combinations that your table currently covers so it's great for completeness checks for particularly large tables. Also handles nested tables gracefully (where the result of one table can be the condition of another table).

Attenuator answered 15/7, 2010 at 6:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.