What is a finite state machine and why is it like CRM 2015 Custom State Model Transitions
A CRM Developer at work mentioned the term Finite State Machine and it was curious because I had never heard of this term.
The CRM developer mentioned it as something you would learn in your first year of computer science course. So I thought I would investigate and the best way to learn something is to learn it enough to explain it to someone else.
So I will start will the description from Wikipedia Finite State Machine
A finite-state machine (FSM) or finite-state automaton (plural: automata), or simply a state machine, is a mathematical model of computation used to design bothcomputer programs and sequential logic circuits. It is conceived as an abstract machine that can be in one of a finite number of states. The machine is in only one state at a time; the state it is in at any given time is called the current state. It can change from one state to another when initiated by a triggering event or condition; this is called atransition. A particular FSM is defined by a list of its states, and the triggering condition for each transition.
Abstract ideas harder to grasp
I remember when I starting out as a Java Developer I found it difficult to understand abstract ideas, particularly Abstract classes and Interfaces.
I have also found abstract ideas are harder to explain to other developers, the main reason for this is because its harder to use scenarios to explain the idea because Abstract ideas can’t be compared to physical objects. Reading the Abstract vs Concrete article on wikpedia, it describes the difficult comprehending abstract ideas
The type-token distinction identifies physical objects that are tokens of a particular type of thing. The “type” that it is a part of, is in itself an abstract object. The abstract-concrete distinction is often introduced and initially understood in terms of paradigmatic examples of objects of each kind:
Examples of abstract and concrete objects Abstract Concrete Tennis A tennis game Redness The red coloring of an apple Five Five cars Justice A just action Humanity (the property of being human) Humanity (the human race)
Understanding a Finite State Machine
- It can have only one state from a finite amount number of states
- The machine can only have one state at a time, this is called the current state
- It can change from one state to another
- When a state changes this is called a transition
- A state change is triggered by an event/condition
Finite state machines may sound like a very dry and boring topic but they reveal a lot about the power of different types of computing machine. Every Turing machine includes a finite state machine so there is a sense in which they come first. They also turn out to be very useful in practice.
- The machine has an input which changes the state of the machine
- The next stage depends on the current state and the input
Pictures are worth a thousand words on finite state machines
Below is a picture taken from Wikipedia here, the example is a finite state machine for parsing the word nice. Notice if you price the correct letter sequence the state moves along. You have the input of the character being typed in but it also checks the current state.
The example has
- 4 states (Inactive, Active, Paused, and Exited)
- 5 types of state transitions (Begin Command, End Command, Pause Command, Resume Command, Exit Command).
| Current State | Input | Next State | Output |
|---|---|---|---|
| Locked | coin | Unlocked | Unlock turnstile so customer can push through |
| push | Locked | None | |
| Unlocked | coin | Unlocked | None |
| push | Locked | When customer has pushed through lock turnstile |
After reading about finite state machine it’s easy to see how you can use custom state model transitions to create this functionality and importantly it helps you think about the status for your entities and what available paths should be available to the user.
What I have learnt from learning about the finite state machine and the new state model transitions is when you are thinking about a Crm solution you should think about the entity statuses and the state transitions, what are the possible paths.
Its interesting to split up the design in
Input
Current state
Next state
Output
The more time you put into design of your CRM solution the better the code will be structured and less changes to design and code later on.
Filed under: CRM 2011, CRM 2013, CRM 2015
This was originally posted here.

Like
Report



*This post is locked for comments