View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default Control program flow

On 19/07/2010 17:09, Dave Unger wrote:
Hello Martin,

On Jul 19, 1:15 am, Martin
wrote:

As we’re using Param1 at 2 different times, to do 2 different things,
it’s almost impossible to keep all the flow, decisions, and action
together. And yes, this example could be constructed more sensibly,
but in the “real” application these 2 procedures could be miles apart.


You should only ever have one routine for checking the inputs are valid!


There is only 1 routine for validating the input. It's the display
routine(s) that are in question. The option is to display the
feedback (each correct/incorrect response with a green/red hilite) as
each question is answered, or, wait until all the questions have been
answered and then hilite. As these 2 events are happening at
different times, I can't see how they can possibly be combined into a
common structure.


One way would be

question = GetQuestionNumber()
CheckAnswer(question, question)
IF realtime THEN
UpdateDisplay(question, question)
ELSIF AllDone THEN
CheckAnswer(1,N) -- needed in case questions right answers interact
UpdateDisplay(1,N)
END


The idea here is that the administrator has the option of turning off
the immediate feedback so the person taking the test is unaware of
right/wrong answers until the end.


Regards,
Martin Brown