Implementing an finite state machine

I have to confess that informatics has to offer some really useful concepts. One of them is the finite state machine. Basically it works like this: The system is in a certain state. Then you have transition matrix that contains the condition for a transition from one state to another. If the update() function is called matrix conditions are checked. If a conditions is fulfilled for the current state a transition is done and the system enters the new state. Here is the current transition matrix:


The states used are:
  • Init: asks the user to drag in some files
  • add_files: at least one file dragged in
  • to_many_files: over fifty files dragged in. Tells the user that less would be better but doesn't force him to do so
  • select_ungrouped: asks to select the "ungrouped cluster"
  • choose_method: ask to put mouse over scan or lookup to get an detailed description of the two methods
  • explain_lookup: As it says, explains the lookup process, advantages and disadvantages
  • explain_scan: same here
  • process_scan: displayed while scan is in progress
  • process_lookup: same
  • successful_finished: explains the color thing and so on..
  • unmatched_files_scan: if scan produced unmatched files the user could try should try lookup.
  • unmatched_files_lookup: if lookup produced unmatched files the user could try scan
  • please_submit: if both methods failed, the user is asked to help MB by submitting the files if possible
Overall the implementation is quite flexible and hopefully easy to maintain.

Comments

OutsideContext said…
Sorry, but I had not yet the time to take a closer look at your implementation. But from what I've seen so far it looks good and I think it's conceptional clean and easy to extend.

I'll look at it early next week and give you more feedback. So you have the weekend for some more features to implement. I'm excited to see this with more of the states working :)

Keep up the great work.
thank you, this really motivates one.

Popular posts from this blog

Setting up a Raspberry Pi for OSX using a direct ethernet connection

cacti and friends

OpenDNS Fritzbox Howto