David Khourshid

Guild Podcast Episode 14

Podcast at Guild podcast, Episode 14, 2022. 12:31 long, 119 views on YouTube. Topics: state machines, visual modeling, model-based testing.

Watch on YouTube (Guild)

What is this talk about?

“I feel like, oftentimes, those states that you haven't accommodated are the sorts of bugs.”

“The idea was we want to create a software platform for application, logic, workflows, E.T.C.”

From the opening of the conversation.

Key takeaways

  1. The idea is that you auto-generate them instead, if you have a state machine, which you could think of as like a big ass flowchart, where it describes your entire app. 4:00
  2. You know, you have these auto generated tests, you have state machines, which naturally prevents invalid states and transitions and things like that. 7:00
  3. As David said, being able to map those inputs to outputs in a nice visual manner with a state machine is kind of intrinsic. 9:00

Quoted from the transcript. Conversations include other speakers.

Full transcript

From YouTube auto-captions. Punctuation and capitals were restored automatically. Technical terms were normalized; some errors remain. 2,525 words.

0:00 Introduction

Hey, there, I'm Taz Singh. And I've been working with communities for as long as I can remember. Fundamentally, communities are made up of people, so this is my journey, going to those communities and talking to those people come along with me. Amazing. So I'm back here with David Khourshid. And so I met. I met David back in Finland and so we were doing a comedy show back there. And we wanted to get. I think Tejas Kumar wanted to do like, like the Babel song, and we, and we, and we. We had like kind of music lined up and everything for him. But then David was there, and so David plays a piano and his actual your Twitter name is David K. Piano, right? Yeah, and so, and so you play the piano, and so he said, Hey, David, like, like, are you able to play the piano for this?

David kindly hopped on. I'm not even sure if he had music or something. No, yeah, song, so or I. I heard. The chords you know chords are simple. Jam along. Yeah, like this guy's always so humble, like it's always so difficult, kind of getting things out of him. Because, like, there's no way in hell I could have done that. But. But like, again, he just finds it simple. But like, Okay, like, I know David, because, like, like David, David built, this piece of technology called X day. He's been very involved with kind of state machines for a very long time. And I think, I think you're like one of the few people to make state machines easy and make state machines approachable. Like, for me personally, I've seen a lot of people try to build state machine libraries and kind of like, like, like, you know, tell people about the values of state machines. But I haven't seen a lot of people make it easy and approachable as you have, so, like, essentially, what's your trick?

Like, how did you like? Like, how did you get there with XState? Well, I think the thing, that I did was sort of approach it in a real world, solve a problem type of way. Because usually the way that people learn state machines is actually through University, if they learn.

Play from 0:00

2:00 Really like, we can generate tests as well

Them at all, right? They'll learn about, finite automata, and like parsing bullions and just things like that. Where there's no obvious connection between state machines in that context and state machines in applications. So then I, I realized that, okay, all of these like user flows and multi-step forms and whatever they could be, expressed with these boxes and arrows. Like, you just are, you're in this state. You follow the arrow, now you're in that state. And so I'm like, Okay, I love this visual idea. I'm a visual learner, so, you know, like adding diagrams to code, it just makes things a lot easier. So I'm like, hey, let's try to teach this and digest it in a way so that other devs could easily apply it to their application. So, like, if I'm mistaken, I think I think I stayed. Has that visual component to it, it does right, right, right, right, right, right.

So that was kind of formative and that kind of helped people understand. And basically, Digestive state machines a bit easier, right? Yeah, I feel like if we didn't have that, that people would not adopt exit, they would be like. This seems like Redux, with more rules, like, with more spoilerplate, like, why would I use this? Yeah, yeah, yeah, that makes a lot of sense. And so if you're familiar with the state machine, it does help you kind of understand. Like, yeah, the various states up your app like that, that's a no-brainer. But I think I think critically. It helps you understand which states you haven't accommodated, right? Like, like all, all potential states, and which states you have accommodated, which states you haven't accommodated. And I feel like, oftentimes, those states that you haven't accommodated are the sorts of bugs. And so, um. Being able to like express that easily and also visualize it easily is fundamental to software development.

And so, so that's, that's super cool. So, if I'm not mistaken, you've since gone on to kind of start a company around this. Yeah, yeah. So about a year ago we started Stately. And so the idea was we want to create a software platform for application, logic, workflows, E.T.C. So basically being like Git lab or Figma for just Applogic in general, like this place where you. Could organize these workflows, use them in your code, generate documentation, generate tests, and have these living diagrams that you know are executed with your code. Really like, we can generate tests as well. Oh yeah, absolutely. And I actually gave the talk about that like a few years ago. It's, stop writing tests, that was basically my talk title, and people are like, wait, why would I stop writing tests? The idea is that you auto-generate them instead, if you have a state machine, which you could think of as like a big ass flowchart, where it describes your entire app.

You could just have algorithms like Traverse each of the possible paths and figure out, okay, here's the hundreds of paths that describe my app, and from each of those, you could have tests. He just, you see what I mean, he's too humble, you know what I mean, he's doing all this crazy stuff. Like auto generating tests and documentation like, like, yeah, like, like, test, some documentation in my head go like, they kind of go hand in hand, which tests often serve as documentation. But being able to auto generate tests based off the flowchart of your state machine? To kind of help determine, application logic, very directly, because it's very directly a test for it. Yeah, that, that's, that's insane. So like, Stately does that, too, Stevie is gonna do that, and he's gonna do. You seriously have a backlog of like five to ten years worth of just, yeah, product ideas that we have? Yeah, so, like, like, Stately today is what, then Stately today is a bunch of things.

We have a visualizer, we have a registry where you could store and save machines, we have a visual editor that allows you to create machines. So people who have been using X8. It takes, you know, a few minutes to create a state machine, but with the editor it's seconds. You double click, drag a line, double click again. You know, you can make a statement, and does that create an XState state machine, or does that create any state machine? Right now? It add ports to something where you could paste it in directly to XD. But because the representation is just JSON weekend, yeah, literally just have this. You know, compiled to GitHub actions or to any other sort of format that sort of understands these directive graphs. Wow, that, that, that, that's amazing. And and as David said, in the future, like right now, this is where the starting from, they're gonna be adding more features in the future.

One of them being auto-generated tests, which just blew my mind. I was talking to David, I think yesterday about this, and I said, like, hey, like, like, essentially like. That sounds cool, like, you know, like, like, this whole state machine flowchart thing sounds cool to me. But like, like, what, like, what's the actionable outcome? Like, why would I use it? Like, what would be the meaningful thing to me? Like, kind of, like, aha, moment for me to say, yes, I'm gonna use this. And I think I think auto-generated tests for me is kind of one of those big parts where, of course, just another layer of testing, another layer of quality assurance. To make sure that you're accommodating, or basically not accommodating certain, like essentially certain paths, is important. So, yeah, that's super cool. Yeah, well, we essentially have three goals, like three major goals, which are value propositions for why you would use our software. The first one is just ship cook faster, like that's immediate business value.

If you could get something shipped, like two sprints early, like that's huge, yeah. The second is ship with fewer bucks. You know, you have these auto generated tests, you have state machines, which naturally prevents invalid states and transitions and things like that. You could ship safe, safer, code faster, and the third one, is collaboration with your entire team. So no more throwing, you know, over the wall. Like trying to talk with your designers and product managers and developers, having them all speak different languages. Now you have this one thing that you could all look at and understand, okay, because, because at the end of the day, that is what's powering the application. Logic directly, right? And so that's all you have to. Like, like, hop into like a component, or hop into like, you know, some sort of Redux reducer thing, and try to like, dissect what's going on. So UFO applications like flow, you can just look at this diagram.

And that diagram is literally with powering your application as well. And so, you kind of, you know, you kind of feed, like three birds of the ones with one scone. It's basically that's how I say, yeah, yeah, yeah, yeah, yeah, that sounds amazing, dude. So like, like, what like is? Is this available to you today? Or, yeah, so. Our tools that we mentioned, the visualizer, the registry and the editor, are available in public beta today at Stately..ai..ai. Okay, cool, a nice, a nice AI. I was in trouble as a state.ly. Nope, I didn't get states without Lee. Someone else has it for some reason. But the AI part is going to be important in, like, you know, a few years. And yeah, that's a part of a whole other discussion. Because traditionally, AI was state machines, like, you can use state machines to describe artificial intelligence in the future. 100, essentially, essentially like, like, like, like, like.

For me. I, I dropped out of cognitive science. And so, incognition, a big part of building AI, a big part of understanding how people work, how brains work. Is basically being able to map every given input to every given output, and if you can map every given input to every given output, for every input and for every output.

Play from 2:00

9:00 We don't have a piano this time because I'd love to…

You've essentially created AI, you know. And, as David said, being able to map those inputs to outputs in a nice visual manner with a state machine is kind of intrinsic. Is fundamentally what you do exactly. And so, kind of essentially. Either doing it heuristically, or being able to do it through some sort of neural net to kind of connect those inputs, outputs, at the end of the day, connecting inputs with outputs, and so, that's super cool. But yeah, we talked a lot about state, we've talked about a lot about XState. Like, like, tell me more about this whole piano thing, because I mean, like, like, I met you, I met you over a piano, really like, like. I remember, we were there in Finland and we're like, Oh, David's here. Like, there's a piano here, and so we just, we just. We just literally gave this guy a piano and he started, like, performing like all.

Of this like, amazing music. And I'm just like, what? Like, this guy's, this guy's? A natural added so like, like, how does that work for you? Yeah, so I actually saw a piano in University I played since I was around five or six years. Oh, wow, and yeah, that was just my passion, like doing it through University. But I realized it doesn't really make as much money as being a developer. Yeah, I was also interested in computers, so I took a couple computer science classes, guys interested in doing developments. And yeah, that's awesome, that's awesome. But yeah, like, he's just a natural ladder now. Just like, what, like, how are you so good at this? But what? Like, like, I think I think he also snowboard. Yeah, yeah, I'm the beginner, you're a beginner, so you're quite as good a piano. No, no, no, no, no. But it's something like, like, if we made a state machine for snowboarding, that maybe, then maybe it'll work out.

No, it frequently transitions to the Fallen state. That's well, at least, accounts, at least, it accounts for the Fallen state. Yeah, it does. So I tried out so, like Kent has his one wheel here, and I tried out his one wheel, like yesterday, and I, I think I almost, I almost killed Kent, but that was that was really hard. Because like, you got to, like, stand on it and like, and like, I'm like. I jumped off of it. And then the one wheel went like, kind of straight for Ken C. Dodds, and so, I, I almost killed Ken C. Dons. And so, that was my primary experience with like two legs, like in a line going in one direction. And for me, if snowboarding doesn't anything like that, it's basically like that, it's basically like that, like that, that, that, that, yeah, like, I don't think I'd be snowboarding anytime soon.

I think I'm gonna stick to skiing, skiing and skating, you know, like it's two feet doing what two feet do well individually. Yeah, yeah, yeah, yeah, but like, like, what, like, do you also ski? Or do you do you skate? Or anything? I skated in the past, but or like, skateboarded, yeah, yeah, yeah, so like, it's kind of. Like the snow version of that, yeah, and living in Florida, you, you know, people tend to Surf here, so I serve too sometimes. Yeah, yeah, yeah, yeah. Because, like, like, essentially, you're, you're just living essentially in Orlando, right? Yeah, yeah, you're in Orlando. Yeah, yeah, yeah, yeah, awesome. Well, yeah, good talking with you, David. Good to see you again, man. Yeah, you're too bad, too bad. We don't have a piano this time because I'd love to see you play once again, but the next time we have a piano, we have a. DaVId. You certainly know, we're getting some good content.

So anyway, pleasure as always, and good to hear about Stately like, that's so cool. I had no idea you guys are doing those types of things. And yeah, I'm gonna go check it out actually. Because I mean, if this is a path towards, like, in my head, I'm still kind of fixing to basically auto-generated tests. But I kind of want to see it for myself now because I think that's super, super cool. So so yeah, I'll see you later, buddy. All right. See you [Music].

Play from 9:00

Related talks