When Booleans Are Not Enough... State Machines?

  Рет қаралды 24,438

Next Day Video

Next Day Video

5 жыл бұрын

Harrington Joseph
www.pytexas.org/2019/talk/U2V...
Booleans are great to represent single states, but when it comes to multiple ones, they are far from ideal. This talk aims to explore cases where booleans are not the right solution, and how state machines may be a better approach when designing objects that describe multiple states and behaviors.
PyTexas2019
The PyTexas Foundation was organized as a Texas non-profit corporation in 2014 and received its 501(c)(3) recognition in early 2015. Although we cannot guarantee that your contribution to PyTexas will be tax-deductible (we aren’t tax attorneys and just don’t know), you can rest assured that any contributions to the organization will always be used to further the common goals of the Texas Python community, and never for personal benefit.
PyTexas is the annual, regional gathering for the Python community in Texas. PyTexas is organized and run by community volunteers. PyTexas, like most of the Python community, is focused on providing a diverse and enjoyable experience for everyone interested in Python. Please help us do that by following the code of conduct.
Produced by NDV: / @nextdayvideo
Python
Sat Apr 13 12:35:00 2019 at Special Event Center

Пікірлер: 36
@AntonioDoesMetal
@AntonioDoesMetal Күн бұрын
I've watched tons and tons of tech talks in the past few years and this one was one of the best I've seen. Thanks for sharing
@madhavsingh7345
@madhavsingh7345 2 жыл бұрын
That is very useful and exactly what I needed. A project I'm working on right now is polluted with flags, and this is going to help so much.
@EloiTeaching
@EloiTeaching 4 жыл бұрын
Surprise of how small are the commentary count on this video. This video is amazing !
@csharp609
@csharp609 3 жыл бұрын
The clearest explanation about the state machine, Thanks.
@derduskenga
@derduskenga 3 жыл бұрын
Genius! Stumbled on this when I was almost giving up
@spaceyfounder5040
@spaceyfounder5040 5 жыл бұрын
Freaking useful!
@onlymecz
@onlymecz 2 жыл бұрын
Exactly what I needed!! Thank you so much!
@devtest8078
@devtest8078 2 жыл бұрын
Excellent talk. State Machines very well explained. Well done Harrington Joseph.
@aleksandrkubar6255
@aleksandrkubar6255 2 жыл бұрын
Great presentation, thanks!
@tienbui1106
@tienbui1106 3 жыл бұрын
It's pretty helpful, thanks
@nikhilgoyal8340
@nikhilgoyal8340 3 жыл бұрын
Nice explanation and use case.
@ashwinmathews9859
@ashwinmathews9859 Жыл бұрын
Excellent video
@fringefringe7282
@fringefringe7282 2 жыл бұрын
Marvelous.
@openroomxyz
@openroomxyz 2 жыл бұрын
Love it thanks a lot!
@user-uh2cr9so8l
@user-uh2cr9so8l 3 жыл бұрын
Highlighted the use case of state machine really well, I needed that. Shame the implementation used a library though
@madsxcva
@madsxcva 11 ай бұрын
great talk
@lycantropos
@lycantropos 11 ай бұрын
in the next iteration people using this pattern will understand that using separate classes to switch between states is a much better approach that can be checked by static type checkers like `mypy` in Python or a compiler in any of OO compiled languages
@lepidoptera9337
@lepidoptera9337 9 ай бұрын
You must be joking... did I miss the sarcasm? Why in the world would you ever smear a state machine over several classes???? That makes it almost impossible to follow your program logic. The very beauty of a state machine with e.g. a switch statement is that it's all in one place... so you (and the people who have to maintain your legacy code!) can see immediately where things are going wrong. This also makes extending the state machine is nearly trivial. You are a good example of what's wrong with the OOP crowd.
@eswarreddy6280
@eswarreddy6280 3 жыл бұрын
great one
@vladimirgorea8714
@vladimirgorea8714 3 жыл бұрын
Ok, this is useful. Thanks
@louaykhammar7268
@louaykhammar7268 2 жыл бұрын
Thanks
@alexanderkyei8947
@alexanderkyei8947 3 жыл бұрын
Very great presentation👍🏿
@chikkai2432
@chikkai2432 Жыл бұрын
👏
@enzotriches7657
@enzotriches7657 3 жыл бұрын
amazing
@brookestephen
@brookestephen Жыл бұрын
Perhaps it's easier to make unavailable functions unavailable in the user interface, rather than generate an error when the user selects an unavailable function.
@lepidoptera9337
@lepidoptera9337 9 ай бұрын
The better way is to give an explanation why the function is not available and what pre-requisites the user has to provide to make it available. Yes, there is the crowd that thinks that the user is a toddler who needs to be put into a tiny cage... that crowd tends to write highly unintuitive and frustrating software that leaves no room for growth, neither for the user nor the software designer. If you want to treat your user like an adult, tell him what the program needs to be able to do more for him. If you can't do that, then you don't understand either your user nor your own software.
@geodome83
@geodome83 2 жыл бұрын
NFA is probably the easiest way to express a state machine, but there are other kind of automata which may be used to model the state machine.
@lepidoptera9337
@lepidoptera9337 9 ай бұрын
A state machine can be written easily with if-then-else or switch statements. No need to complicate things.
@willculpepper9637
@willculpepper9637 Жыл бұрын
1) Say what you're going to say. 2) Say it. 3) Say what you said. This is the way.
@ahmednabil5119
@ahmednabil5119 3 жыл бұрын
But how does state machine library works? It checks the state (true or false) for every condition. He only abstract the code using an external library.
@rednafi
@rednafi 3 жыл бұрын
Go read the source code of the pytransitions library. It's a 20 minutes talk. What do expect? I think the speaker did a fantastic job in explaining the problem and pointing the audience in the right direction.
@lapidations
@lapidations 2 жыл бұрын
@@rednafi I agree. Even if I'm currently struggling to implement a state machine, I watched this to understand the use cases and design, not the implementation.
@yash1152
@yash1152 2 жыл бұрын
umh, yeah, but abstraction is good. It's reusable, it's maintainable, it's flexible. it's less error prone. so, even if it's abstracted, it still fits the aim of the talk. by the way, thanks for the comment (:
@lepidoptera9337
@lepidoptera9337 9 ай бұрын
@@yash1152 Abstraction for abstraction sake is a bad idea. Everybody who can touch your code understands if-then-else and switch... and almost nobody wants to read the documentation for your choice of state machine library. Moreover, you may be running into some serious performance problems with libraries that are too general for your particular use case.
@totrantien
@totrantien 2 жыл бұрын
amazing
Building Docs like Code: Continuous Integration for Documentation
29:21
Python's Class Development Toolkit
45:56
Next Day Video
Рет қаралды 237 М.
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 34 МЛН
Best KFC Homemade For My Son #cooking #shorts
00:58
BANKII
Рет қаралды 71 МЛН
MISS CIRCLE STUDENTS BULLY ME!
00:12
Andreas Eskander
Рет қаралды 20 МЛН
Secret Experiment Toothpaste Pt.4 😱 #shorts
00:35
Mr DegrEE
Рет қаралды 37 МЛН
Stop Writing Classes
27:29
Next Day Video
Рет қаралды 932 М.
How NES Games Use State Machines For Everything
8:21
NesHacker
Рет қаралды 33 М.
Computers Without Memory - Computerphile
8:52
Computerphile
Рет қаралды 335 М.
David Khourshid - Infinitely Better UIs with Finite Automata
25:33
Loop like a native: while, for, iterators, generators
29:15
Next Day Video
Рет қаралды 117 М.
The Clean Architecture in Python
49:54
Next Day Video
Рет қаралды 109 М.
Non-Deterministic Automata - Computerphile
21:09
Computerphile
Рет қаралды 53 М.
Pycon Ireland 2018: Finite State Machines in Python - Brian Stempin
41:40
ВОДА В СОЛО
00:20
⚡️КАН АНДРЕЙ⚡️
Рет қаралды 34 МЛН