State diagram Vs Flow chart

Thread Starter

Djsarakar

Joined Jul 26, 2020
489
Hi

The intension to ask this question is that usually many people makes flow charts or state diagrams. There will be many people who don't even make both

Whenever you design a project, when do you think that you need a flowchart or a state diagram?
 
Last edited:

WBahn

Joined Mar 31, 2012
29,932
Your title implies that you are asking about comparisons between the two, but your first post seems like you are asking something else.

There are many ways of planning a project, state diagrams and flow charts are simply two of the many tools at your disposal. As with everything, each tools as advantages and disadvantages and using the wrong tool for the project at hand can be worse than not using any tool at all.

Nearly all but the simplest projects will benefit from using some kind of planning tool, either formally or informally. You should get comfortable with several, learn how to effectively use each, and gain enough experience so that you can choose a good tool for the current job (and that experience almost always comes from choosing a bad tool for the job).
 

WBahn

Joined Mar 31, 2012
29,932
Depends on the project. The tools that you might use for designing a shopping center are very different than the tools you might use for designing a jet fighter or the website for a real estate broker or a nuclear power plant.

Also, there are many different aspects of most projects (above a certain very small size) that need to be managed. The tools you use to schedule engineers against the various tasks is going to be different than the tool you use to design the database relationships for that same project.

You need to really narrow the scope of the discussion in order to have much of a chance of it being meaningful.
 

dl324

Joined Mar 30, 2015
16,788
The intension to ask this question is that usually many people makes flow charts or state diagrams. There will be many people who don't even make both
For my personal projects, I've never made a state diagram. I only use flow charts for programs that have too many branches for me to keep track of in my head; or if I'm doing it for the benefit of someone else.

These days I use flowcharts more often because I have chronic pain that prevents me from sitting for more than an hour or two and often distracts me enough during that time to make me lose my train of thought too frequently.
 

MrChips

Joined Oct 2, 2009
30,621
These days I use flowcharts more often because I have chronic pain that prevents me from sitting for more than an hour or two and often distracts me enough during that time to make me lose my train of thought too frequently.
Off Topic

btw, chronic neck, shoulder, back pain is very common for computer users. I too have had chronic back pain from prolonged computer usage. It has been diagnosed and remedied by proper physiotherapy diagnosis and treatment.

The solutions are:

1) Change your chair
2) Change your computer work station
3) Change your posture while at the computer
4) Remedial stretches and exercises
5) Limit the time spent at one task
6) Take frequent breaks from that task and do frequent arm/neck/shoulder/back stretching exercises during breaks.

The good news is that I no longer suffer from these pains as long as I continue to practice the tips above.
 

djsfantasi

Joined Apr 11, 2010
9,155
Hi

The intension to ask this question is that usually many people makes flow charts or state diagrams. There will be many people who don't even make both
You followed up WBahn’s response with another question, regarding what other tools people use.

I often write a requirements document, describing in natural language what the project has to accomplish and what constraints are placed on the document.

I also write out a data definitions document, describing discretely what variables or values are input, what are output and in the case of code, what structure I anticipate to use.

And, often in lieu of a flowchart, I will write an outline of the code in pseudo-code. This is a natural language, step by step, of my algorithm. This interim step eliminates worrying about a specific language’s syntax while getting the process done.
 

jpanhalt

Joined Jan 18, 2008
11,087
I have only written "state diagrams" once and that was when I was writing code for driving a stepper-motor based meter. A state is a, "particular condition that someone or something is in at a specific time." (Source: Google) A flow diagram tells you how to get there.

I see no overlap.
 

dl324

Joined Mar 30, 2015
16,788
The good news is that I no longer suffer from these pains as long as I continue to practice the tips above.
Still off topic.

I was t-boned by a 20 year old girl who ran a stop sign on a state highway. The impact spun my vehicle 180 degrees. I have damage at L4-5 and nerve impingement that causes sciatic pain that shoots down both legs.

Had a bilateral laminectomy in that area for the sciatic pain. That stopped the pain at my thighs for about 3 years. The nerve damage in my left leg from the surgery healed and the sciatic pain is back, though less frequently and I have more feeling in that foot. My car has a manual transmission, but I don't drive enough for me to be too concerned about it causing me to kill the engine at an inopportune time.

They offered disc fusing for the back pain, but I declined because the surgery I had sent me to the emergency room, after vomiting blood for hours in recovery.

Before the accident, I could code for 16-20 hours at a sitting for weeks at a time. Had occasional tightness, but no bouts of very severe/extreme pain.
 

WBahn

Joined Mar 31, 2012
29,932
A flow chart is really nothing more than a graphical depiction of the logic of an algorithm that is able to show taking actions (calculating something, inputting something, outputting something, etc.) and the effect of answering simple yes-no questions.

A state diagram is really nothing more than a specialized flowchart that can be used when the range of what actions can be taken and what effects are possible is sufficiently limited.

When the system can be characterized by a set of states and transitions between them, it is begging for a state diagram. In some systems, at some levels of abstraction it is reasonable to use one but at other levels of abstraction it is reasonable to use the other. For instance, at the top level I might have a system that can be described by a state diagram but, upon entering a state, there may be things that need to happen that are best described by a flowchart. The reverse can also be true -- a certain block in a flowchart may represent a task that is best implemented using a state machine.
 
Top