Book a Demo

Author Topic: Brain fade - how do I  show "or" gu  (Read 2715 times)

sargasso

  • EA Practitioner
  • ***
  • Posts: 1406
  • Karma: +1/-2
  • 10 COMFROM 30; 20 HALT; 30 ONSUB(50,90,10)
    • View Profile
Brain fade - how do I  show "or" gu
« on: June 08, 2005, 11:18:23 pm »
..ards (title truncation exception handled)

I have an activity that is invoked under a set of different guard conditions from a prior activity.  In other words, lets say activity A passes control to activity B if 4 conditions are true.  If any of three of the four are false, control passes to activity C.  If one specific condition fails, control passes to activity D.

(  A  )  ------------ [All 4 conditions are true] -------------> (  B  )
    |    |
    |    |------------  [condition 4 is false]  ---------------> (  D  )
    |
    |------------[(condition 1 | condition 2 | condition 3 ) is/are false]  ------------------>  (  C  )


How does one best show the OR condition in the activity digram?  All as one guard?  As separate control flows into C?  ...?

Also A must pass to C the nature/s of the failed condition/s.  However, regardless of the nature/s C performs the same actions.  So, this is not in line with my understanding of the "activity parameter" dingbat.  

Any thoughts?

tia
bruce



« Last Edit: June 08, 2005, 11:21:13 pm by sargasso »
"It is not so expressed, but what of that?
'Twere good you do so much for charity."

Oh I forgot, we aren't doing him are we.

mikewhit

  • EA User
  • **
  • Posts: 608
  • Karma: +0/-0
  • Accessing ....
    • View Profile
Re: Brain fade - how do I  show "or" gu
« Reply #1 on: June 09, 2005, 01:51:41 am »
IMHO ... I think guards are OK for 'switch' type or clearly disjoint alternatives (eg. condition 4), but when it gets more complex, I prefer to write out conditionals explicitly and in sequence with diamonds.

That way there are no (fewer!) misunderstandings - or bugs ... Clarity wins, over conciseness, for me.
« Last Edit: June 09, 2005, 03:07:21 am by mikewhit »

Paolo F Cantoni

  • EA Guru
  • *****
  • Posts: 8626
  • Karma: +259/-129
  • Inconsistently correct systems DON'T EXIST!
    • View Profile
Re: Brain fade - how do I  show "or" gu
« Reply #2 on: June 09, 2005, 02:27:15 am »
bruce,

I would disagree with Mike regarding diamonds versus guards.  However, you DO need to be careful...

Because condition 4 can be false regardless of the state of the other three conditions, you MUST check for its state explicitly and then the others.

Also, from Boolean logic you can replace any composite false "or" condition with a NAND (not AND).

From the way I read your narrative the picture should look like:

(  A  )  ------------ [(condition 1 & condition 2 & condition 3 & condition 4)] -------------> (  B  )
    |    |  
    |    |------------  [NOT condition 4 ]  ---------------> (  D  )
    |
    |------------[condition 4 & NOT ( condition 1 & condition 2 & condition 3 ) ]  ------------------>  (  C  )

then you can make (composite) guards as appropriate.

(caveat:  I don't have my electronic engineering textbooks to hand... ;D  But I think I'm right)

HTH,
Paolo
« Last Edit: June 09, 2005, 02:28:37 am by PaoloFCantoni »
Inconsistently correct systems DON'T EXIST!
... Therefore, aim for consistency; in the expectation of achieving correctness....
-Semantica-
Helsinki Principle Rules!