Your skill will accomplish what the force of many cannot |
|
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
One structure you may want to consider is a State Machine. Now, I am sure CS and algorithm purists will have a far better definition that what I have here, but I will make an attempt.
and so on. Now, several of your forms may want to perform the same processing - for example, checking a form value that could be on several forms. So the decision for the new value of &mystate could depend on what the initial request was. Percentive monks will see that by using a sequence of IF blocks, within one pass of the loop, the program may pass through several states in sequence - that is not a problem. That advantage of this approach is that you have broken up your processing logic into a number of discrete chunks, each doing a particular function (validating an address, doing a data base search for a list of courses, whatever), and hence becomes easier to maintain. As well, your business logic - what is required to process a course booking, for example, is listed in the logic of chosing the state progressions. So if you need ot add some additional business logic at a later stage (oops - we forgot that we need an email address when accepting course bookings), then you can add it reasonable simply. I apologise if the explanation is a trifle obscure - one should not try to undertake algorithm design late on a friday evening! In reply to Re: Flow control / case structure
by Maclir
|
|