Very very complex logic can be modelled with decision tables to be sure you catch all the paths.
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Neven MacEwan
Sent: Tuesday, September 18, 2001 6:22 PM
To: Multiple recipients of list delphi
Subject: Re: [DUG]: Help with Logic flows

Mark
 
Have you looked at UML, This may be an oblique answer but 'activity' diagrams will help
The UML Tool i'm using is minUML (from www.minuml.com ) is pure Delphi (and will have Delphi Web Script scripting)
If you are getting repeated calls in the else then your process flows are wrong (making decision a ahead of b or not combining
your decisions logic correctly, UML activity diagrams are like flowcharts but have 'forks' and 'joins' which help in modeling this
 
example
 
if you have 2 binary forks (hard to express in text) but you have 4 outcomes (but only 3 decisions), coded in if then else you get  (pseudo code)
 
if conda
  then
    if condb then proc1()
    else proc2()
  else
    if condb then proc3()
    else proc1()
 
you are using 2 binary decisions to get 3 outcomes, A solution I saw once from the Mark Edington? (borlands ADOExpress architech)
for this was (and I would never thought of it) pls excuse any syntax errors
 
const
  Decision: array[boolean,boolean] of Int = ((1,2),(3,1));
 
case Decision[conda,condb] of
  1: proc1()
  2: proc2()
  3: proc3()
end
 
HTH
 
Neven
 
----- Original Message -----
Sent: Tuesday, September 18, 2001 5:20 PM
Subject: [DUG]: Help with Logic flows

Help!
 
I'm building myself an increasingly complex maze.
 
Has anyone any tips on how "real programmers" keep track of the logic that is necessary to ensure that multi level nested if...then...else statements are constucted properly.
 
I seem to be often getting into situations where I find myself executing similar sets of statements after 'else's at different levels in a set of nested if...then...else's.
 
Are there any *methods* that one can employ to ensure that these structures are correct?
 
I find that after about 2 levels I cannot comprehend what else is going to be executed when.
 
Any tips or references would be greatly appreciated.
 
TIA
 
Mark

Reply via email to