Hi Wouter,
the difficulty for me was that a transition trigger was already there but
in order to model a choice, I needed a second trigger on the same
transition which is illegal in UML. But let me explain the situation
first. Look at the class diagram of the business layer:
* The business layer contains a binary decision tree, made out of
DecisionItems.
* Each DecisionItem is able to produce a prompt for the user and is able
to link to two other DecisionItems.
* There is a root DecisionItem (has the isRoot attribute set to true).
* In the web app, there is always a "last" or "current" decision item.
Now, the flow should be as follows:
1) The system asks the user, using the prompt of the current
DecisionItem.
2) If the user answers "yes" or "no" to a prompt, the system proceeds to
the next Decision item via the "yesSuccessor" or "noSuccessor" link of the
current DecisionItem.
4) If the successor link is not null, the system gets the next
DecisionItem and repeats step 1.
5) If the sucessor link to be traversed is null, then winner = (lastAnswer
== "yes" ? system : user).
This basic behavior is completely independent of whether the DecisionItem
is an Animal or a Question (these classes extend DecisionItem). The
difference between an animal and a question is only the calculation of the
prompt string.
Now, my problem:
If the user answered "no", the system traversed the "noSuccessor" link and
if it was not null everything was OK. If the link was null, the system
said "you win" and asked for a differentiator question and the animal. It
inserted the Question as a new DecisionItem and set the "noSuccessor"
(which was null) to point to the Question. It inserted an Animal and set
the "yesSuccessor" link of the new Question to point to the Animal.
So far, so nice. The result was:
elephant, yes=null, no=does it swim
does it swim, yes=fish, no=null
fish, yes=null, no=null
Now, I played the second time. The following dialogue took place:
System: Is it an elephant?
Me: No.
System: Does it swim?
Me: Yes.
System: You win!
This was too early - the system should have followed the "yesSuccessor"
link of "does it swim" and should have come up with "Is it a fish?".
Then I tried to modify the activity graph. I wanted to insert a choice
after the "correct" transition and wanted to insert a call event to a
method that fetches the "yesSuccessor" link. I could not do that because
the transition already had the "correct" trigger as an event.
See what I mean?
Cheers...
Matthias
--- Urspr�ngliche Nachricht ---
Datum: 24.03.2004 07:35
Von: [EMAIL PROTECTED]
An: [EMAIL PROTECTED] ("Matthias Bohlen")
Betreff: RE: [Andromda-devel] Quiz running better but not perfectly
> >Wouter, there is an error in our "guess" activity graph. If the answer
> >to a question is "yes", the graph immediately goes to "I win". Imagine
> >however that the user answers "yes" to "Does it swim?". The system
must
> >ask "Is it a fish?" and if the user answers "yes", then the system
must
> >say "I win".
> >
> >We need a second fork in the flow but I don't know how to add it.
Could
> >you have a look?
> >
>
> when you say you don't know how to add it, do you mean from a technical
'bpm4struts' POV, or you don't know how to model it appropriately in UML ?
(I ask the question because I want to anticipate user problems and reduce
the learning curve)
>
>
> I have been playing a little with the UML model, but I am wondering
about something in the business layer, I would need an answer on at least
one of these questions:
>
> 1) when you prompt the user with a question, is the system aware of the
type of question (really guessing the animal, or asking a differentiator
question) ?
>
> 2) is the following logic correct ?
>
> a. the system tries to guess the animal
> b. when correctly guessing the animal the system wins
> c. in case of failure the system asks a differentiator question
> d. if there is no such question, the user wins
> e. if the user answers 'yes' to the question we go back to (a)
> f. if the user answers 'no' to the question we go back to (c)
>
> in this case I have a solution, but I would need to know one more thing:
when the system fetches the next decision item, can it be both an 'animal
guess' and 'diff question' ? because I think it is not clear from the
diagram, maybe we could introduce the notion of 'getNextAnimalQuestion()'
and 'getNextDifferentiatorQuestion()' ?
>
> In this case it would be clear only diff. questions can exhaust (each
diff question is backed by at least one animal) so the condition currently
implemented as 'nextDecisionItemAvailable()' would map onto the diff.
questions.
>
> can you let me know ?
> thanks.
>
> Wouter.
>
>
>
>
>
> __________________________________________________________________
> Introducing the New Netscape Internet Service.
> Only $9.95 a month -- Sign up today at http://isp.netscape.com/register
>
> Netscape. Just the Net You Need.
>
> New! Netscape Toolbar for Internet Explorer
> Search from anywhere on the Web and block those annoying pop-ups.
> Download now at http://channels.netscape.com/ns/search/install.jsp
>
-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
Andromda-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/andromda-devel