Domanda

Hi and sorry advance if this has already been covered.

I'm mainly preoccupied with writing numerical software but I'm a bit of a noob when it comes to application design.

I've written a library that essentially takes input from different data streams or static files, performs some data analysis and outputs the data to screen or file etc and I've decided to write a gui application to make it a bit more user friendly.

The sequence in which library calls must be made is fairly simple but there are some constraints on which events should be handled depending on the state the application is in. I.e. I don't want the user to start grabbing from a data source whilst they are already processing from another.

So I've decided to use a finite state machine. However, I was wondering on what the best practice for integrating a finite state machine into your application is. Should I make it the public interface to my library or should I essentially use it as the controller in an MVC framework, with the library being the model and GUI being the view? Or is there a better way of controlling the flow of your application?

Thanks for your help.

È stato utile?

Soluzione

You got it right. Gui = View, FSM=Controller, Library+ Static data + Database + Model.

Having said that, see if you can further split the FSM into two parts. The state transition definition itself should be made declarative so that you can easily change the state rules. The FSM should be a simple state transitor which uses the rules in the state rule base.

you can store the rules declaratively using PMML, a variant of XML.

Take a look at this, it will explain what I tried to say, more eloquently: http://en.wikipedia.org/wiki/ADAPA

(not related to ADAPA)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top