Click here to Skip to main content
14,493,767 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.
 
GeneralRe: goodBye camel Pin
dandy723-Jan-20 3:48
Memberdandy723-Jan-20 3:48 
GeneralRe: goodBye camel Pin
W Balboos, GHB3-Jan-20 5:56
mveW Balboos, GHB3-Jan-20 5:56 
GeneralIn defense of goto Pin
honey the codewitch2-Jan-20 20:45
mvahoney the codewitch2-Jan-20 20:45 
GeneralRe: In defense of goto Pin
OriginalGriff2-Jan-20 21:54
mveOriginalGriff2-Jan-20 21:54 
GeneralRe: In defense of goto Pin
honey the codewitch2-Jan-20 22:00
mvahoney the codewitch2-Jan-20 22:00 
GeneralRe: In defense of goto Pin
Member 79891222-Jan-20 23:40
MemberMember 79891222-Jan-20 23:40 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 3:59
mvahoney the codewitch3-Jan-20 3:59 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 4:54
MemberMember 79891223-Jan-20 4:54 
Now I have come to accept 520 states to be "within reason" - but of course it is large.

If you were familiar wiht X.225, with its mere 32 states, you would know that without the supplementary state variables and predicate mechanism, but each cases modeled as a separate state, there would have been hundreds of states - maybe exceeding 520. The state variables is a way to reduce the size of the FSM. By proper use of state variables to collapse "n" states into one, with substates representing those "n", you can make it far more managable. Obviously those "n" substates have largely the same behaviour; they are not arbitraritly chosen.

Also, events may carry data. Say, if you parse a number, you do not model 0 through 9, +, - and decimal point as thirteen different events: All digits are born equal, so you have digit event, a sign event and a decpt event. Handling of digits is different in the integer and the fractional part, so you could make that two different states - or you coud make a decpt event set a state variable indicating 'fraction part', that steers the handling of the subsequent digits. And you would have a prediacate on this fraction part variable: If it is set, another decpt or sign is a protocol/syntax error.

Starting out with 520 initial states before you start cleaning up and grouping them into "significant" states, and grouping those events that are treated equally in the FSM as single events carrying data, sounds like a task that can be managed with reasonable effort. The size in itself is not a reason for rejecting an FSM approach.

In the X.225 standard, the presentation of the FSM is split over several state tables, each with a subset of the states and events, so they look like quite small tables. But they are just subsets of that rectangle of the total state table covering only those states (columns) that define handling of some events (rows): If an event occurs in any other state, it is illegal, square empty. E.g. those events related to connection establishment and those states related to connection establishment are shown as subtable. I have included this into my framework editor: You may define any number of sets of events and states, and display only those rows and columns that cover the area you are currently working on. You can have a "blob-and-arrow" plot of this subset. When you are done with, say, the connection part of the protocol, and go on to another subset: In the B&A plot, the connect phase states may be appear as a single "super-state" where the intermediate states in that stage are hidden inside a single blob.

I would be writing far less code than in any other approach - once the table is in place. FSM is NOT for that super-"agile" approach where you start with typing into your code editor "int main(int argc, char** argv) {" before you turn to the customer: "Now we are going - please describe your problem to me!" An FSM approach certainly requires a significant problem analysis, and even solution design, before you can start building your transition table. (In that sense, it is not a "modern" method...)

With an FSM, I would be relieved of writing tons of flow control. With a generator, I would be relieved of writing tons of function headings etc. I would be focusing on the true actions only, not how to get to them. Porting to another language would require a fraction of the work, compared to porting the full code body. I am using this approach because it saves me a whole lot of code writing!
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 4:58
mvahoney the codewitch3-Jan-20 4:58 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 5:27
MemberMember 79891223-Jan-20 5:27 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 5:29
mvahoney the codewitch3-Jan-20 5:29 
GeneralRe: In defense of goto Pin
pkfox3-Jan-20 1:24
professionalpkfox3-Jan-20 1:24 
GeneralRe: In defense of goto Pin
Member 79891222-Jan-20 22:43
MemberMember 79891222-Jan-20 22:43 
GeneralRe: In defense of goto Pin
honey the codewitch2-Jan-20 22:50
mvahoney the codewitch2-Jan-20 22:50 
GeneralRe: In defense of goto Pin
jsc422-Jan-20 23:15
professionaljsc422-Jan-20 23:15 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 5:05
mvahoney the codewitch3-Jan-20 5:05 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 0:14
MemberMember 79891223-Jan-20 0:14 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 3:56
mvahoney the codewitch3-Jan-20 3:56 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 5:16
MemberMember 79891223-Jan-20 5:16 
GeneralRe: In defense of goto Pin
honey the codewitch3-Jan-20 5:23
mvahoney the codewitch3-Jan-20 5:23 
GeneralRe: In defense of goto Pin
glennPattonWork2-Jan-20 23:13
professionalglennPattonWork2-Jan-20 23:13 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 0:35
MemberMember 79891223-Jan-20 0:35 
GeneralRe: In defense of goto Pin
glennPattonWork3-Jan-20 0:41
professionalglennPattonWork3-Jan-20 0:41 
GeneralRe: In defense of goto Pin
Member 79891223-Jan-20 1:32
MemberMember 79891223-Jan-20 1:32 
GeneralRe: In defense of goto Pin
Rick York3-Jan-20 5:02
mveRick York3-Jan-20 5:02 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.