State machines are a nice pattern, but true and false could also make up the entirety of states of a simple state machine. You don't need to make an enum of them.
An old - school cyberteck sort of chad , who works with javascript and web applications in a variety of settings. -
I provide tech support, and software through my business @https://techsport.app
Location
Louisville , Ky
Education
UofL , Comptia A++ , NSA Professional Certified , IBM Certified Enterprise Engineer
Graduated in Digital Media M.Sc. now developing the next generation of educational software. Since a while I develop full stack in Javascript using Meteor. Love fitness and Muay Thai after work.
at this point, you should consider using OOP instead of ADTs to solve this, like move the ifs to the respective classes as methods in order to implement something like the State pattern, making the code less verbose.
An old - school cyberteck sort of chad , who works with javascript and web applications in a variety of settings. -
I provide tech support, and software through my business @https://techsport.app
Location
Louisville , Ky
Education
UofL , Comptia A++ , NSA Professional Certified , IBM Certified Enterprise Engineer
State machines are a nice pattern, but
trueandfalsecould also make up the entirety of states of a simple state machine. You don't need to make an enum of them.Can you do a demo so I can refer to the code ?
Thank you sir -
I added a code example in the Exceptions section of the article. :)
I see the author added a part "the exception" and I welcome the addition.
Definitely one way to look at it. Sadly it's too verbose in TS.
Nice write! What's software you use to make that diagram?
Anyway, I also write article about simplifying complex state in React with reducer :)
Simplify state with reducer
M. Akbar Nugroho ・ Mar 8 '23
I'd also like to know the tool to model the state machines.
stately.ai
stately.ai
at this point, you should consider using OOP instead of ADTs to solve this, like move the ifs to the respective classes as methods in order to implement something like the State pattern, making the code less verbose.
Very interesting, thanks for writing!
I love the concept of a "state machine" for its simplicity and ease of understanding.
Thank you !
Good one
Thank you 🙏
Great it's too help Full Pentagon Detailing...