A podcast where we explore unimportant programming questions (mostly PHP/Laravel/JavaScript) in extreme detail.
00:00:07.12
Chris Morrell
All right, welcome back to over-engineered, the podcast where we asked the very important question, what's the absolute best way to do things that we already have a perfectly acceptable solution for.
00:00:18.40
Chris Morrell
Um, today I'm here with Sean McCool. Sean, do you want to say a quick hello?
00:00:22.53
Shawn McCool
ah Hello.
00:00:24.22
Chris Morrell
Um, Sean is, I think. You, I don't know if, I think maybe I got a little bit into event sourcing before I came across your event sorcery ah course on YouTube. But I feel like your ah your course on event sourcing introduced me relatively early on to a lot of the concepts ah a lot of the concepts around event sourcing. um And so it was very instrumental in my alert early understanding of the concept.
00:00:58.10
Chris Morrell
Um, and I have gone on to, uh, become pretty interested in the subject. Um, and you know, we've been using the spot C event sourcing package at internet chief for many years now. And, uh, Daniel and I co-authored verbs and have been, uh, sort of advocating for.
00:01:19.29
Chris Morrell
slightly different approach to event sourcing for the last year or so. ah And then ah you know it seems like you you've kind of, I don't know, maybe I just wasn't looking in the right places, but it it seems like you've kind of come back into the conversation a little bit more recently. is that is that ah Does that feel true? Do you feel like you're starting to starting to like want to have these conversations again or were you just elsewhere and I wasn't looking in the right place?
00:01:46.34
Shawn McCool
Yeah, so I was I guess I worked really hard to make the event sorcery videos. It took me a long time because I had no idea what I was doing with content creation and I'd make a video and I'd hate it and I'd start over again.
00:01:58.80
Shawn McCool
And it's only like three and a half hours or something like this. And it still took me like a year to produce. So that was a big endeavor.
00:02:04.51
Chris Morrell
I can believe it.
00:02:06.15
Shawn McCool
After that, you know, I was working ah working on Larikani U, working on stuff like this. ah And I did, I just kind of focus, I was focusing on ah building my own tools and experimenting with my tools. And I wasn't doing a lot in public. ah But now I think i I see a big resurgence in this topic. like So a lot of people are bringing it back up again. And it's interesting to me, because this is the one of the things I love the most, to be completely honest. I have been enamored with it for like 10 years now.
00:02:36.64
Shawn McCool
and all of this developing and and ah new ways of of seeing how this stuff can come together. It's all very exciting to me. And so I'm i'm really, I'm here for it. I'm 100% here for this.
00:02:48.62
Chris Morrell
That's awesome. Well, you've been doing a series of YouTube or not. I don't know if it's just YouTube broadcast or Twitch broadcasts, but you've been doing a series of sort of live Q and a talking about event sourcing. How many how many of these have you done? Is it two or three now?
00:03:03.38
Shawn McCool
Yeah, it's three. it's It's really, for me, just an experiment. like ah I want to see if there's room here for me to make content, if it if I can pace it well enough, if I can find a format that's a good fit, if it's fun enough to keep sustainable, if people care at all. you know I don't know anything about it, so I just started. And every week, you know I get better, or I try to experiment that doesn't work, or whatever. And I guess we'll see where it goes from here.
00:03:27.72
Chris Morrell
I really like i like the approach that you've taken of like trying to make it a more live experience. um it's something That's something that I have, excuse me, that I've tried to do myself in various formats, but it's not it's not easy because you really have to you have to get people to commit to show up at the time that you're doing it, which ah is is a challenge, especially, I mean, you know and in the though the world that we live in where you know, half my friends are in Australia or in Europe or, you know, in, in absolutely different time zones from me. I mean, even us today, it's like, I, I ah typically would record in the afternoon, but it's nine 30 here because it's, it's already three 30 in the afternoon for you. So, um, if that poses a bunch of new challenges, but I really love the premise of it and it feels like it's been working pretty well. Like.
00:04:25.20
Chris Morrell
You've had a couple of great guests. You've had a bunch of interesting sort of questions and conversations. Does it feel like the experiment is like going as well as you'd hoped?
00:04:35.68
Shawn McCool
Yeah, I would say like ah for me, there are high points and low points. you know i'm I'm very picky about like pacing, like what I think is an okay pacing. So things start to slow down too much. you know I get like a little bit antsy about that, and so I want to try something new to to manage the pacing. There's a limited amount of preparation I can do. I can do some.
00:04:55.90
Shawn McCool
But i can't like really scripted and have it all prepared and if even if i did that it wouldn't be sustainable for me to keep doing but thank you thank you for the the kind words ah i i really want to have an opportunity to talk to like complete strangers and i.
00:04:58.97
Chris Morrell
right.
00:05:12.67
Shawn McCool
I post on Twitter one day. I said, hey, just if you want to talk about event sourcing or something, if you're having trouble with it or or if you're having a challenge at work, just talk to me. I can I'll block out a small period of time and we'll have a conversation because I want to get I want to get more experience with like a variety of people's circumstances.
00:05:28.64
Shawn McCool
And I want to think about that. And I want to also just have these conversations. But then I was also thinking, what would be cool if this was in public? And because, you know, with a lot of this stuff, there's a lot of hand waving like, oh, you just do this thing.
00:05:40.65
Chris Morrell
or
00:05:41.63
Shawn McCool
And in reality, it's really hard to get into the topic with people because if I were to tell you all of the detail that you need to know to talk about some topics, you get super bored because it's very specific to my work and it's like it's too intricate. If I if I ramble on about work specific stuff for too long, nobody would be able to follow it, right?
00:06:02.53
Shawn McCool
You have to be onboarded onto those ideas at work for like a year at a time, you know, in order to figure it out.
00:06:04.29
Chris Morrell
Or... Right.
00:06:07.73
Shawn McCool
But I think that there is a way to have a conversation about the the parts of software engineering that we usually don't get to dig into in public in a way that I think is helpful for people.
00:06:21.47
Chris Morrell
Yeah. Yeah. I love it. I feel like there's a bit of a, I don't know. There's a bit of a movement in that direction. I see. Um, I don't know if you're familiar with, with Ben Holman, but he's been doing this, uh, pyramid scheme where he's just like, uh, he's just got a calendar. You can block a time to pair with him for, for an hour. And, uh, sometimes you work on something that you're interested in. Sometimes he will pair on something that he's interested in with you. Um,
00:06:49.42
Chris Morrell
And that's been sort of like spreading because because his kind of deal is okay if you if you pair with me then then your commitment is that you offer to pair with someone else afterwards.
00:07:00.64
Shawn McCool
Okay.
00:07:00.98
Chris Morrell
um And that's been very fun. ah And just in general, yeah, I feel like maybe maybe this is ah a little bit of the aftermath of of everybody kind of surviving lockdown is is ah we've looked for new ways to kind of connect with each other. And um this is just another one of them. But I don't know. I love to see it. It's been really fun to to watch and participate in some of these things.
00:07:31.22
Chris Morrell
um And so yeah, I, I guess, you know, I hopped on your, your last stream for about 20, 25 minutes and and we were talking a bit and I'd love to get back to that conversation or, you know, sort of pick up from there for awhile. But I also, before we get there, I feel like, um,
00:07:54.30
Chris Morrell
I, I guess I kind of came into the Laravel community, not late, but later than a lot of folks. Um, you know, I was kind of just like in.
00:08:06.31
Chris Morrell
Uh, in, in my own old school PHP code base, just kind of chugging along for a long time. And, uh, I came to Laravel in like the, you know, five dot six, five dot eight era, something like that. Um, which, you know, obviously is, is a number of years ago now, but I feel like a lot of people who are, who are sort of old school Laravel that.
00:08:29.49
Chris Morrell
They talk about that as though that's like the modern era of Laravel, you know, that that's like the ah there's like this sort of split point there. um And so for me, i I guess I don't know if it if it's just like just circumstance or happenstance or whatever, but I was introduced to you really only as like this event sourcing guy until um until we were on the, uh, the PHP round table when it turns out, Oh no, you're like a old school, longterm, uh, layer of all community person as well. And i I don't know how I didn't know that. Um, so I'd i'd love to just hear like, I don't know a little bit of, uh, yeah, you're like your, your backstory, how you got into that space and then like how you got to where you are now, which sounds like a very different kind of professional world to some degree.
00:09:24.91
Shawn McCool
Yeah, i I would have to say I was doing a lot of PHP. I started with PHP in like 97 or something like this. And it was a very different beast. And I was doing a lot of PHP stuff. And at some point in time, actually, I was like, let go for my business for my job, because honestly, I don't think I was doing very good work.
00:09:46.84
Shawn McCool
I was doing the best I possibly could, but the the world had like progressed past include dot pet MySQL.php at the top of the ah the file.
00:09:55.18
Chris Morrell
huh
00:09:56.44
Shawn McCool
And then I just i started discovering like the world of frameworks like CodeIgniter was there. and It was still like a an early version. It had some time to mature.
00:10:07.20
Shawn McCool
and And I started discovering, hey, I could go to these meetups, or hey, I could meet people. And I started being exposed to so many new ideas that it was it like she completely changed everything I was doing. i'm like I always wanted.
00:10:19.07
Shawn McCool
like Programming to me is ah one of my primary interests. like i so I found it when I was nine, and it was magic to me, like literal sorcery. I had an idea, and it manifested. you know was It was like casting a spell.
00:10:29.54
Chris Morrell
yeah yeah
00:10:32.09
Shawn McCool
And ah so I when I. When I found Coding Nighter, when I found the communities, I could go to the the conferences or the meetups or whatever. Everything changed for me like overnight. I started learning.
00:10:42.84
Shawn McCool
i started I basically found a font of wisdom that I could just continue drinking from forever. and To this day, um I find like things like meetups and conferences to be the most important things in my career because you know you network and you you meet people, you get exposed to ideas.
00:10:53.53
Chris Morrell
Yeah. Yeah.
00:10:59.39
Shawn McCool
and Every once in a while, you find something that you didn't realize you were missing. right so
00:11:04.14
Chris Morrell
Yeah, for sure.
00:11:05.74
Shawn McCool
Uh, I was getting tired of coded nighter because it was not evolving anymore. And I was like, okay, well, I need this thing to be more like, quote, modern. You know, I was looking around the world, like seeing like the things was happening in Ruby at the time and stuff like this with rails. And I was like, I want more of this. And.
00:11:22.55
Shawn McCool
i I basically switched my company. At this time, I had made a bunch of Code Igniter tutorials, and people came up to me and said, hey, I tried to make a website for my business, but it's too complicated for me, but I like the way you talk about it. Will you do it? So I made a business just making people's stuff from from those tutorials.
00:11:39.57
Shawn McCool
And ah at some point in time, I i went to Coding NiterConf and I was like, okay, why aren't you announcing anything new happening with the framework? Like, why aren't we modernizing? And they're like, ah, it's fine. And so, okay, I'm like, this is not okay. So I wrote this article called Coding Niter is Dead, or I can't remember what it was, but it was kind of a really controversial article at the time. I think you can still find like on the Wayback Machine, but you got it just,
00:12:05.38
Shawn McCool
it it kind of blew up. And at this time I was like, OK, maybe just choose Laravel and Laravel was I don't know, Laravel 2 maybe at the time, maybe Laravel 3 I can't recall.
00:12:16.07
Shawn McCool
And this this guy Taylor, like there is a IRC channel like 10 people on it in this channel.
00:12:16.25
Chris Morrell
Okay.
00:12:21.78
Shawn McCool
Dale Reese, Taylor, maybe Ian Landsman. I don't remember just a variety of people and they were all super cool and everybody was like really into like let's have a PHP framework that's drawing from these other sources and it's more modern.
00:12:35.04
Shawn McCool
And so that that's kind of how I got into Laravel. And then I got super into Laravel because I was working for myself. We had this IRC channel and I spent all of my time just talking to new joiners about how the framework worked, about how to do different things in the framework, about how to think about you know developing this thing or that thing. And before I knew it, the IRC channel got to like 450 members. And I was like, OK, it's time for the like the next generation. And like I kind of just stepped back. and you know like i At my time ah in the community, I created a Laravel meetup in in the Netherlands. LaraCon EU founded that with a colleague of mine.
00:13:15.79
Shawn McCool
Laravel.io, a colleague of of mine and I built the original version of that. ah We made the original Laravel podcast, a bunch of stuff.
00:13:24.55
Chris Morrell
um
00:13:25.17
Shawn McCool
It was like basically like all I could think about all the time was like community projects having to do with Laravel. It was really awesome. ah Still, ah so many of my friends, my closest friends I met on that adventure.
00:13:38.01
Shawn McCool
And um yeah, so mostly I just, ah these days I'm doing a little bit different work. i'm I'm working in Java, which I'm not super happy with, but the the technical challenges are cool um and doing some other stuff.
00:13:46.10
Chris Morrell
Hmm. Hmm.
00:13:50.56
Shawn McCool
There's not really a ah space for that for me. And when I'm doing something on the side, I'm trying to figure out like, okay, how can I push some boundary or another?
00:14:01.09
Shawn McCool
So I'm i'm focused on like Erlang or Elixir and like really digging into something different because what I'm trying to do is break Break my mental models and reform them in a different way, right?
00:14:12.27
Shawn McCool
So I'm just looking to break stuff and that's kind of where I am now I'm not really doing a lot of community effort But I do miss the community and and my time with the Laravel community was some some of my best time
00:14:12.96
Chris Morrell
Sure.
00:14:23.78
Chris Morrell
Yeah. I mean, the Laravel community is really. it's It is special. I mean, i you know, I feel like that's a little bit of just a a thing people say, but it really does feel true. I go into layer kinds and ah meetups and and just being connected to these people online. Like, it just feels like a real welcoming group of people who become friends, you know, um which hasn't been my experience in other programming communities, not to say that there aren't other programming communities that are like that.
00:14:54.82
Chris Morrell
um But yeah, it's a, it really is a lovely place to be. And I, yeah, I, I i really appreciate it. And I, I mean, um, it's, it's interesting because it feels like there's a new round of, um, there's a new round of community stuff happening right now. Again, I think kind of coming out of the pandemic.
00:15:18.34
Chris Morrell
A lot of the events and meetups that existed either shut down entirely or paused for a long time. um And I think that in the in the recent years, even when folks were starting to gather again.
00:15:33.40
Chris Morrell
um you know I think it just took people a long time to get used to being a around groups again.
00:15:40.87
Shawn McCool
Yeah, for sure.
00:15:41.21
Chris Morrell
um But I know for me, starting to go you know going into the first Laracon in Nashville after after the pandemic and then um going to the one in in Dallas, um you know my experience very much was just like,
00:15:59.08
Chris Morrell
I can't do this only once a year, you know, um, and all of our local meetups shut down. Um, even before the pandemic there, there really was the PHP meetup had closed years before the pandemic and a lot of the other groups that I was involved with all, all sort of just petered out a little while before then or, or finally ended, um, with lockdown. Um,
00:16:28.38
Chris Morrell
And so yeah, i've been I've been organizing a local Philly meetup and it's i I totally get it. It is just like just really fun. It's really fun to like connect with your local community and and um I can really see why it would it could take over your life to some degree.
00:16:46.33
Chris Morrell
you know it's like ah i i love I love to like have these interactions and be around these people and and it's been really joy.
00:16:53.51
Shawn McCool
Yeah, and and you you you can get a lot out of it. there's ah There's a lot of ways you can benefit from doing a thing. um I think sometimes you get somebody who will organize and stay around for a really long time, and there's a lot they bring a lot of value because they they know so much. They've made so many connections that they can they can make this happen. But I think it's also like really important to continue to give like the next generation I don't mean generation like age-wise, but like the next group who've come in who are like at this point in their career or in their adoption or in their ah entrance in the community where they're super motivated and really leverage that motivation, have them organize more things, have them participate in more things.
00:17:35.22
Shawn McCool
And I think this is one of the things Laravel has done really well over time is being like really
00:17:35.37
Chris Morrell
Yeah.
00:17:40.68
Shawn McCool
welcoming such that, you know, new people come in, they're super pumped just to be there with one another. And they will take this, this labor that needs to be done happily. And they get a lot out of it as well. They get more connections, they get the you know, all of their little endeavors get a little bit more boosting and there's just a lot of value there.
00:18:00.06
Shawn McCool
But I think that when I was trying to different communities, like the Scala community and stuff like this, I didn't get this vibe at all. It was like almost hostile. yeah It was not, it was not for me, but, uh, you know, the, I'm in the Elixir community now and they're really cool.
00:18:08.45
Chris Morrell
yeah
00:18:14.71
Shawn McCool
And I still, most of my friends that are in my, uh, programming discord and stuff, I are very much in the Laravel community and, uh, I don't think I'm gonna lose those roots anytime soon.
00:18:26.91
Chris Morrell
Yeah. You said you're doing Java right now. Are you, uh, are you getting to use Kotlin at all or is it like, uh, OGE?
00:18:35.11
Shawn McCool
No, it's it's not as bad as it's not as bad as what I would call OG because Java also has changed a lot over time like PHP has, right?
00:18:43.08
Chris Morrell
Okay. Yeah.
00:18:44.40
Shawn McCool
um But at the same time, it's it there they're coming at it with a very different culture and there's something about the more, what I consider like minimalistic, keep it naive until it needs to be more complex type of culture that I see in PHP that resonates more with me.
00:19:00.92
Shawn McCool
When I'm dealing with Java, everything's so much more complex and I don't think often for the betterment of the system, right?
00:19:01.15
Chris Morrell
ah
00:19:04.79
Chris Morrell
the
00:19:09.54
Chris Morrell
Yeah. Yeah. I mean, I haven't, I, the last time I wrote a line of Java code is probably 2003. So that's, that's, uh, that's the, the style of Java that I'm thinking of, but I, I maybe not recently now, but in the last couple of years, I, um, I, I started to learn a little bit of Kotlin because I wanted to write a PHP storm, uh, plugin.
00:19:33.48
Shawn McCool
Yeah.
00:19:33.69
Chris Morrell
Um, and I, I actually find that, that language very. like, I don't know, inspiring. I totally agree with what you were saying earlier. I don't get the opportunity to do it as much as I'd like, but there's something really, really powerful about just like learning a new programming language or a new framework or a new, you know, just a new way of thinking down to just like syntax things and like, so and like sort of like, what's the,
00:20:03.85
Chris Morrell
you know, idiomatic way of approaching a problem in this like sort of ecosystem, even if it's not specific to the language, it's just like, there are little things that you will do that, you know, everyone does in this language because that's just like, that's just how it's done. Um, that like make a lot of sense. And I've found bleed, you know, can, can bleed into my, uh, my sort of coding aesthetic in general. Um, if it's not like a language feature.
00:20:33.66
Chris Morrell
And then there are language features that you're just like, ah, man, I wish the PHP would, would implement this, you know? Um, so it is really fun.
00:20:40.28
Shawn McCool
Yeah,
00:20:43.31
Shawn McCool
yeah I think I think when I discovered event sourcing like at first I had to discover domain events as a concept and then I started leveraging those. as everywhere I possibly could. Then when I started ah actually building event source systems, I was like, OK.
00:20:56.98
Shawn McCool
And there's a switch flip to my brain. And now all I want to do is find new ways to do the things I was already doing. Because if they could be this nice, right then then what else could I be replacing?
00:21:05.83
Chris Morrell
Right.
00:21:07.84
Shawn McCool
right So that's where like this focus on the actor model and other stuff that I'm focused on now is coming from. like Event sourcing taught me that. ah something can be very similar to what I'm already doing, but radically different at the same time.
00:21:22.39
Chris Morrell
Right. Yeah. Yeah. No, I mean that, that's a really great tape takeaway. It's like. Um, it's easy to get stuck in certain ways of thinking. And, um, a lot of times there's a good reason for that. It works, you know, it's effective. You already know it, like that's fine. and Um, but sometimes that does mean that you're like missing out on a whole other sort of way of seeing things that might make your life a lot better or might make, you know, the applications that you write easier to to understand or, you know, some, all sorts of different benefits.
00:22:01.05
Chris Morrell
Yeah, no, I definitely get that. Um, well, okay. So let's get, let's get back to event sourcing because I, I do, um, I do really look for, I did really look forward to to talking about this with you. So, um, I think, I think for me, like the, the biggest thing that I.
00:22:21.81
Chris Morrell
and focused on right now. And honestly, I mean, Daniel and I have talked a little bit about just dropping the term event sourcing from the verb stocks and sort of like from, uh, how we talk about verbs because, um, I, I, I think that like, it can be easy to get caught up in like sort of the like technical, like what is event sourcing? What is, what is the formal definition of event sourcing, which frankly, I just don't really care.
00:22:50.10
Chris Morrell
um But the thing the thing that like was the big aha moment for me really came down to this idea that like, It's the events that actually happen. And as programmers, we we work so hard and we twist ourselves in all sorts of different ways to try to model this data that represents what is the outcome of these events, right? And we throw away so much real information and we have to we have to jump through all these weird hoops. The one that we always come back to is like,
00:23:27.66
Chris Morrell
you know, when you have a, when you have an eloquent model that's got 15 different timestamps on it, because you're trying to like track all this different like time data.
00:23:36.39
Shawn McCool
Yeah.
00:23:37.44
Chris Morrell
Um, half of it's because you actually need some of those timestamps and half of it's because you're worried that someday you might need one of those timestamps. Um, and all of these efforts are really just because in a lot of ways we're modeling the wrong thing, right?
00:23:52.70
Chris Morrell
We're trying to say, we're trying to represent the passage of time and and like this this this rich ah experience that people have in these like static snapshots of a given moment. right And we just lose so much. And the that that that switch that flipped for me with event sourcing was, oh, if I just represent like the the thing that matters in my application, like this this person just was promoted to an admin, right? Or like this account was just deactivated. Or, you know, like the thing that actually happens, the words that we actually use when we're talking about our application, um if I model those things,
00:24:43.00
Chris Morrell
then the rest of it I can kind of infer however I need for my application, right? The rest of it just kind of like flows out of that. And that's obviously a core piece of event sourcing um or that in my mind, that is really what event sourcing is.
00:24:59.42
Chris Morrell
um And the rest of it is just sort of like technical ways to approach that sort of that understanding of the world.
00:25:07.00
Shawn McCool
You have mitigations on mitigations.
00:25:07.17
Chris Morrell
But, um,
00:25:08.75
Shawn McCool
Like, oh, now we have this problem we have to solve. So you create a new mitigation for that problem. It's always this way with technology, right? Like you have this core kernel, this this way of thinking about things, whether it's, you know, tying your objects to relational database or whatever else.
00:25:15.27
Chris Morrell
Yes.
00:25:22.97
Shawn McCool
And then everything else like ripples out of that, it feels like.
00:25:26.80
Chris Morrell
Yeah, for sure. Does that feel like a fair sort of like base definition to be working from?
00:25:34.11
Shawn McCool
Yeah, I think that um people often, including myself very much, so ah couple all these things together because you know I'm working with all of these things together.
00:25:44.91
Shawn McCool
And what I'm trying to do is ah find coherent ways of working such that I have all these tools that complement one another.
00:25:45.06
Chris Morrell
Yeah.
00:25:53.11
Shawn McCool
And so I'm often talking about you know queuing ah patterns, patterns for inter-process communication or inter-service communication, stuff like this. And that has like nothing really to do with event sourcing. um Event sourcing, event streaming, there's all these other things. but I think when um trying to I have the opportunity to sit down with somebody and talk about event sourcing and they're like a programmer and I can work through it, because you know it's really easy to talk about this also with non-programmers, which is kind of funny.
00:26:22.66
Shawn McCool
um But I can sit them down and say, okay, now create a class that would be like a normal model for you and put put methods on it that you would interact with it.
00:26:22.76
Chris Morrell
Mmhmm.
00:26:30.74
Shawn McCool
But when you're on the inside, just store a little associative array representing the thing that happened, in that thing. So if I have an order class and you have an order ah place method, just store inside of it an associative array that says, oh, event type placed with the the the values and just do ah that a few times. And then we run into the need to have an understanding of what the previous event states were in order to make decisions about the new state. And we just like step through the process, complicating it only so much as to take it to the next step. And then people like intuitively understand it at its core in like,
00:27:08.80
Shawn McCool
45 minutes and it's it's the kind of thing that you know, if you don't worry about the infrastructure That's like a just a implementation detail, you know that people saying Don't worry about that. Just focus on the fact that the the changes the state changes are just the recording of these whatever data you have available that represents an order being placed or a Payment being made whatever the data you have is fine
00:27:32.40
Chris Morrell
Yeah. Yeah. Yeah, I mean, that's really, that's that's basically what it comes down to, right? It's just, and and the thing that I always tend to say to people is like, you know, storage cheap storage is cheap. Like, try to capture as much as you possibly can in your events, right? Try to try to make your events as closely represent what actually happened as possible. you know My my like go-to joke is like if I could record like the room temperature at the time that the event fired, I would. you know like um But yeah, if you if you accurately describe what happened,
00:28:15.44
Chris Morrell
then the sort of ramifications of that, you can kind of decide after the fact kind of, okay, you know what do we what what do we care about?
00:28:23.48
Shawn McCool
yeah
00:28:27.00
Chris Morrell
you know um And as long as you have it.
00:28:28.24
Shawn McCool
yeah and like
00:28:30.54
Chris Morrell
Go ahead.
00:28:30.50
Shawn McCool
Absolutely, and and it's like the only it's like the only state pattern in which you don't lose data. like There's not a single bit of data lost in this pattern, right and that's also very special. The way I like to think about it is that the different parts of my application are different people. so A person observes a thing that happened, right that they remember it, and then they may communicate it to somebody else, so like an order system versus an inventory system or something like that.
00:28:54.56
Shawn McCool
And there's just two people. And then the inventory system, here's what the order person says. And they're like, OK, I get what these order people are like, but I'm going to remember the fact that they communicated in my own way, from my own perspective.
00:29:08.21
Shawn McCool
And so to me, these systems are just recording the things that happened according to a specific perspective. And then you can have any amount of perspectives that have different incentives or different concerns ah reflect on that event in a unique way.
00:29:21.36
Chris Morrell
Um, yeah, I like, I like that. I like that framing of it. That's fun. Um, so
00:29:33.50
Chris Morrell
So then the the next piece that always comes up, um and and this is, I feel like this is your, ah this is the the place that our conversation sort of started was when you get into this idea of like the aggregate, right? Which um in verbs we call state. I love, I love the term decision model. That was, that's like such a great, such a great framing of it because that's, you know, that's,
00:30:01.97
Chris Morrell
That's how I try to communicate this concept to people is like, you know, this data is meant to ask questions of when you need to decide about future events, right?
00:30:05.04
Shawn McCool
Yeah.
00:30:12.21
Chris Morrell
And that's all that it's there for. um And so when you say decision model, that's that's just so such a genius term. um But, you know, very quick quickly when you're building out the these events or systems, you you run into this question of like,
00:30:29.18
Chris Morrell
um Okay. Well, can this event be fired based on the current state of the world? Like the current state of the world does actually matter, right?
00:30:40.53
Chris Morrell
Like you, you, it's nice, uh, sort of. Theoretically to say, well, everything is just like a series of events, but the reality, huh?
00:30:48.43
Shawn McCool
That would be easier. That would be easier, yeah.
00:30:51.94
Chris Morrell
Yes, but the reality is sometimes you need to understand where we happen to be in that series and what the consequences of some of those past events were ah in order to determine whether subsequent events are are allowed or what kinds of subsequent events should be fired or or whatever it is. And so that's when we come to you know what's what's often referred to as the aggregate route or ah anything, any of these other terms that I said.
00:31:21.98
Chris Morrell
Um, and it's funny because I feel like that was the hardest idea for me to wrap my head around. Uh, and now that I do, it feels like such a straightforward concept that I can't even remember why it was so hard for me in the first part. Does that, does that resonate with you?
00:31:42.31
Shawn McCool
Yeah, it's true ah that an aggregate as a concept is difficult. like In any case, like so I got really into the domain-driven design kind of world, ah and that's how I kind of got deep into the event sourcing, got access to people who knew a lot about it, and they were doing it way before I ever came around.
00:31:58.34
Chris Morrell
um Sure.
00:31:59.63
Shawn McCool
right and so I had some mentors who could help um help me navigate this. and so ah Getting into all the terminology of the domain-driven design stuff had already given me an advantage when coming into this space.
00:32:12.82
Shawn McCool
But ultimately, the thing that I had to come to realize is that ah The model is just events. The thing that matters is just events and everything else is there to facilitate some idea like but this aggregate or this decision model as Frank de Jonga, the author of EventSauce.
00:32:34.33
Shawn McCool
pitch to me on on stream like the ah the other week. um It's just a way of loading the ah the events that might be relevant in memory so that we can reflect on them in memory. And that's just it. And then we can reflect on the things that have happened in memory and make a decision about should I emit a new event saying a new a thing happened or should I prevent that event from ever ah Being admitted so if that event comes out and is stored well It's it's real now that that's how you know the thing happened because the events are everything in an event source system Me too
00:33:05.45
Chris Morrell
Yeah. Yeah. And it's, it's funny. I, it I don't know this, I think this maybe exposes my, I, you know, I'm a self taught programmer. I'm, I, I don't think of myself as a math person and I don't think of myself as like a, uh, I don't get real deep into the more like technical theoretical stuff in programming. Um,
00:33:30.99
Chris Morrell
I had a and the programming, ah one of the few programming classes I took in college, my professor was like a early AI, um you know, pioneer and he like, he loved the Lisp and just like,
00:33:45.50
Shawn McCool
Of course.
00:33:46.49
Chris Morrell
The, it just, uh, everything that was beautiful to him in programming was incredibly frustrating to me in programming. Um, but honestly, it took me so long to even understand like, Oh, just like, uh, just like in my SQL, you have like the aggregate function, some that's all we're talking about. It's like.
00:34:08.75
Shawn McCool
Right.
00:34:09.55
Chris Morrell
when you say aggregate that's that's all it is it's a reducer yeah it's like uh it's it's as simple as that it's just uh it's just an aggregation of all the events uh or or yeah like a reduction of all the events to to a single point in time um but it i am embarrassed to say it took me a long time to like kind of have that aha moment
00:34:09.53
Shawn McCool
It's, it's a reduction. Yeah.
00:34:32.78
Shawn McCool
Yeah, if I could go back and tell myself, okay, it's really just about you need the events that happened in the past and you need them in memory. And this is the way that we get those events in memory. And then we can write the code that says, oh, if one of the previous events had this value, then it's okay to make a new event.
00:34:50.26
Shawn McCool
you know it's It's really just that easy, but we're so used to doing everything in these data models and like and like an active record model with its relationships. We make we do so much with these.
00:34:58.72
Chris Morrell
Yeah.
00:35:00.69
Shawn McCool
that with ah with an event source model, some of that logic and behavior is extracted across the system a little bit more evenly. And so you end up with like a a chunk of code that is a little bit more distributed than all like located within this one set of data models. It's weird to get used to, for sure.
00:35:21.22
Chris Morrell
Sure. Yeah. So like the next, I think the next, um, sort of concept that really landed for me when I was digging into this stuff was um like the, this idea of like the separation of like a write and a read model. and I don't necessarily love those terms, um but starting to think about like the reality that is right now ah as a, you know, when I'm, when I'm just dealing with a, you know, ah active record, like eloquent,
00:35:56.39
Chris Morrell
I essentially have to encapsulate all my application's needs into one thing, right?
00:36:02.73
Shawn McCool
Yeah.
00:36:02.81
Chris Morrell
I need to, yes.
00:36:02.97
Shawn McCool
And if you don't, you pay the price because like you, you, you could separate like these into different features, but there's so much redundancy, like the feeling of all the redundancy that you would have to to do makes you push it all back into one model.
00:36:15.56
Chris Morrell
yeah
00:36:17.87
Shawn McCool
And then you have like this one unified model for all of your different read use cases for all the, the, the ways you want to write to it.
00:36:25.50
Chris Morrell
Yeah. Well, and even just like if you, if you learned anything about database normalization or like sort of these, uh, the, the like quote unquote, right way to data model, you know, you're kind of like pushed in that direction. Um, and, and.
00:36:41.46
Chris Morrell
Yeah, the reality is kind of going back to the to the original concept. We end up jumping through all these horrible hoops, you know, or having to write either these gnarly join statements or like, uh, you know, run sort of less efficient queries because we.
00:37:00.02
Chris Morrell
you know because we just need to jump across multiple tables and ah you know gather our data in these strange ways because our UI needs to show the data to the end user in a certain way. But we also need to be able to write to that table in ah in a way that like makes sense from the user's like right perspective. right they're They're going and changing changing some data in a form and hitting save, and they want that data to be saved.
00:37:30.15
Chris Morrell
But they also want to be able to go to a table and view all the relevant data connected in the right ways, clickable into the right places, you know, with the, with the right little badges.
00:37:35.01
Shawn McCool
Yeah.
00:37:41.81
Chris Morrell
Like they, the end user needs both of those things. And, and we end up having to do a bunch of machinations to make our data support both of those things.
00:37:54.54
Chris Morrell
When we're talking about like a, an eloquent model, right?
00:37:56.96
Shawn McCool
Absolutely. Yeah, I think i think the if when you're doing this kind of thing, right ah you also kind of lock down your code base over time so because you have so many different reasons to be interacting with this model.
00:37:59.60
Chris Morrell
so
00:38:12.05
Shawn McCool
This model might be the most interesting model for for this use case, but this model is just a relationship to another use case right and they're all interconnected. So what what happens in my experiences, ah they're also highly coupled that it's hard to change one without impacting the others even if
00:38:26.77
Chris Morrell
And so, okay.
00:38:29.23
Shawn McCool
reasonably, you you shouldn't have to modify the the other feature in order to modify this one. they're all They're all tied together, so it becomes very, very difficult to make a change.
00:38:40.43
Chris Morrell
yeah Yeah, so then in the event sourcing approach, the upside of all of this is you get to separate those two things. You get to essentially write events that describe exactly what happened, and then you get to you know listen for those events and write to a database the data that your application needs to show the data to the end user or to present the UI. you know I think like it it took me a long time to wrap my head around this idea of
00:39:13.30
Chris Morrell
really the eloquent models that i that are like these quote projections that are the the end result of these events being fired from my application's UI perspective, really are only there to serve the UI, right?
00:39:26.67
Chris Morrell
They're not there for any other purpose, ah and but that frees you up to say, oh, well now I can just build these data models that are
00:39:26.68
Shawn McCool
Yeah.
00:39:36.90
Chris Morrell
100% optimized for presenting on the screen, you know, um, and I, I can just throw away all these horrible joins and horrible, um, you know, uncomfortable relationships that I needed, um, and just write models that make sense for my applications. Uh,
00:39:58.50
Chris Morrell
interface, knowing that the other side of it is I get to fire events that are a hundred percent catered to what interaction is happening in the application, right? You get these like two beautiful, separate things that when you, when you first read about the concept, right? If you hear about like CQRS or something like that, and you're like command query, what is going on? But the reality is.
00:40:28.57
Chris Morrell
It's just that there are two different sides to most applications, right? There's the like view side and there's the the the interaction side and they have different needs, right? And like you can separate them now.
00:40:42.35
Shawn McCool
Yeah, so um one of the interesting consequences of having a read model that's isolated and specific to a specific use case is that you can hand it off to another team and they can own that. And now because events are fundamentally a decoupling pattern, right? This is this is just messages themselves or a decoupling pattern event.
00:41:02.52
Shawn McCool
is one of the types of messages. um You can distribute ah these different things in various ways, whether they're physically, whether they're based on ownership. like Really, CQRS is I like the idea of taking this to an extreme where all the different features, e etc., all the different use cases are isolated from one another and they can be evolved independently because in my experience, the the big trouble that we get into comes from coupling feature after feature after feature until it becomes ah the the amount of time it takes to implement a new feature or to modify a feature.
00:41:40.71
Shawn McCool
just goes up. And what do teams do when that becomes a problem? They do some kind of rewrite, but they use the same fundamental approach that they use in the first place. So it's just a matter of time until that coupling reaches the the critical mass where the cost is so high, or so many bugs are introduced from a simple ah change that what should have been a simple change.
00:42:00.32
Shawn McCool
But like read a read use case is is sufficiently different from a write use case, which is different from a different read use case, which is different from a different read.
00:42:07.72
Chris Morrell
Mm, mm-hmm.
00:42:09.50
Shawn McCool
And so like having all these isolated from one another, to me, is the true reason that I like to pursue this. I want like a radical separation for maximal of evolution of independent features. right
00:42:23.01
Chris Morrell
Yeah, no, that's a really interesting way to think about it. I think i think that that that I end up, I think, having a different perspective on certain topics because I've only ever, not just with you, but just in general, I find that this is a place where um where my experience is just just different than others in that um you know I've only ever worked on a team of up to three people.
00:42:51.69
Chris Morrell
Um, and I've worked on the same code base since 1997. Um, so I have, I have like a different experience, um, around some of these, uh, you know, some of these, these gotchas.
00:42:56.37
Shawn McCool
Impressive.
00:43:08.70
Chris Morrell
Um, because I've never really had to deal with like, okay, we've got three different teams working on three different parts of the application in there, you know, but they have some overlap and we have to like navigate.
00:43:21.68
Chris Morrell
those barriers you have to, and I totally appreciate that as as the size of your team scales up, ah solidifying those like those barriers and and really set setting um some more strict rules about, or but those boundaries rather, um matters a lot, right? And I just can't really speak to it because it's never been it's never been something that I had to deal with.
00:43:47.91
Chris Morrell
i um You know, i I really appreciate the fact that I've always been able to work on a small nimble team that just like we pretty much all have the the mental model of the entire code base.
00:44:00.46
Shawn McCool
Yeah.
00:44:01.35
Chris Morrell
you know so not Not to say that I have the full mental model of the code base in my head at all times. it's yeah You can imagine that ah over 25 years, you build a lot of features. um And there are certainly things that I come back to and I'm just like, how did this work again? I haven't touched this in five years.
00:44:22.02
Chris Morrell
um But it's different. And so i I don't really, I've just never had to think about event sourcing in that context. I can appreciate how it could be really valuable there, um but it just, it's never been a concern of mine, and you know?
00:44:38.58
Shawn McCool
Yeah, I can appreciate that. and But I would say like um i don't want to be I don't want to be interpreted incorrectly. it I push for like radical independence of features. I push for all of these things, but for me, my my personal value system is in maximum like maximally naive systems. right I want to write the simplest possible thing that will work reliably for my circumstance, tied directly to my circumstance, not a generalized solution that's going to be put into a library and shipped off to
00:45:10.44
Shawn McCool
solve an infinite number of varying problems. I want i want to directly tie my code base to the problem I'm facing now. And then as those problems evolve, because we have and our new ideas about how we want to solve new things or take on new challenges or react differently, I want the code base to be the exact simplest possible thing that fits that. And so I think that like,
00:45:34.13
Shawn McCool
just because you're like pursuing architecture designs or it's just because you're pursuing different kind of values, I don't i don't think there is a there's a necessary critical mass of complexity that you have to get to. ah for For example, if I was just building a simple application for myself, maybe I would actually find that like event sourcing my model in this use case is simpler to me.
00:45:58.82
Shawn McCool
than creating ah an active record implementation. Because I don't think that the they that one is just fundamentally more complex than others. They have trade-offs, but I do think that there is so much complexity in other approaches as well, like the relational model, the the data model oriented approach is extremely complicated you know over time or in certain circumstances as well. so I just want to like clarify. To me, the simplest possible implementation for whatever it is you're dealing with,
00:46:29.00
Shawn McCool
That's what I want to go to because the shortest amount of time I have to spend ah Not solving the problem or I mean though, you know, the time I spend not solving the problem is is something I want to completely avoid
00:46:40.62
Chris Morrell
Sure. Yeah. No, no, I, I, I get that. I, I, I hope I didn't. I, I don't think that that's not what you're saying. ah That's double negative there, but, um,
00:46:51.75
Chris Morrell
Yeah, I mean, I think that that's something. I can't say that I always um can live up to that. I definitely have a personality ah that really likes to go go towards like framework level thinking. um i like you know and i And I end up doing that and I release a lot of packages for various ah various problems that we've solved because I like to.
00:47:20.20
Chris Morrell
um go to that outer level of abstraction. Um, but I appreciate, you know, I know, I know that I could probably get a lot more done if I didn't. Um, and, uh, in a lot of ways it's just like, that's something that I find fulfilling. So I let myself do it, but I do think that you're absolutely right. I mean, the number of times that, uh, I've let myself introduce abstractions too early or try to solve a bigger problem than the problem that I have right now. And it's come back to bite me is, you know, Close to 100% of the times that I've done that. So I'm well aware, I'm well aware of that pitfall. And I think that the, the more you can, um, the more that you can be really, um, Brutally honest with yourself about what the needs of your application right now are.
00:48:18.92
Chris Morrell
and and focus in on that specifically, the better a time you're going to have, for sure.
00:48:24.47
Shawn McCool
Yeah, but how how are you gonna find what's simplest, right, if you're not experimenting? There's was the other side of the coin.
00:48:29.65
Chris Morrell
Yeah. For sure.
00:48:30.39
Shawn McCool
You gotta play, I think.
00:48:32.30
Chris Morrell
Yeah. Well, yes. I mean, I think i I almost feel like this wouldn't be an episode of Overengineered without me talking about the idea of of programming as art.
00:48:42.69
Chris Morrell
I feel like that's just like a theme that I always come back to. and I feel very strongly about that. like Programming is art and art requires creativity and exploration. and and um you know I feel incredibly grateful to to be able to do a thing that I find fulfilling and I find interesting. and I don't want to give that up.
00:49:11.20
Chris Morrell
in the name of productivity, right? So there absolutely is a balance there. And I i don't i don't necessarily feel feel bad about any of those times when I, you know, over-engineered something um because I do think that there was always a lesson to learn and there's, ah there's or or it was just fulfilling in the time to do it that way. And okay, I learned from that mistake, right? um So it certainly is a balance for sure.
00:49:40.61
Shawn McCool
yeah i I personally, might my the most enjoyment I get out of software engineering or programming is when I'm experimenting with something. So you know experimenting with something wholly new, it's a sometimes painful ah process of you know having to struggle to understand something, having to grind at it until you figure it out. And then you know you get a good enough idea about what you're doing and you go and implement it at scale. Now you have a whole ton of different problems and ramifications to deal with. And that's all really cool and fun.
00:50:11.89
Shawn McCool
but you know I have strong suspicions that software development is going to continue changing. and I'm not talking about like language models or something. ah We can change our approaches now.
00:50:22.56
Shawn McCool
like if im If I could go back in time 20 years with the things I know now, I could i know that I could like make books you know that would change the way that everybody saw everything because i've i' we as an industry have learned so much stuff and we've made the problem problem so much easier.
00:50:32.95
Chris Morrell
Sure.
00:50:38.29
Chris Morrell
Yeah.
00:50:41.63
Chris Morrell
Yeah.
00:50:41.60
Shawn McCool
then, well, I mean, not not universally easier, right? There's still a lot of building complicated solutions to fix problems that maybe we didn't need to have in the first place.
00:50:52.65
Chris Morrell
Sure, but it's still I mean for all the complaints about like modern JavaScript tooling or you know the ways that we've made our lives more complicated ah people people like to look back and think about oh it was just like a beautiful time when I could just write a PHP script and, uh, you know, open up cyber duck and drag and drop the file onto the server. And that was the whole story. I don't know, man. I remember those times and honestly, we have legacy systems where I'm not that far away from those times. Um, you know, we, we have a legacy system where it's only the last
00:51:34.84
Chris Morrell
you know, nine, 10 months that we had like a pull request, uh, process that, that could happen, you know, like up until then it actually was, uh, FTPing into the server and and uploading files direct.
00:51:50.03
Chris Morrell
It was not great. What we have now is great. You know, we have a lot of really lovely things.
00:51:53.42
Shawn McCool
Yeah, no, it's, I agree.
00:51:56.58
Chris Morrell
It's the better world now. Um, so I, I agree wholeheartedly.
00:52:01.48
Shawn McCool
At the very least, we have much more communication, much more education, more mentors, you know, at the very least, because when I was trying to figure out a program, I wanted, I was so thirsty for absolutely anything.
00:52:08.66
Chris Morrell
Yeah.
00:52:14.65
Chris Morrell
yeah Yeah.
00:52:14.71
Shawn McCool
And it it was like, it was dry.
00:52:18.47
Chris Morrell
Yeah. Yeah. I mean, yeah. Well, yes. Um, so I would, I would love to pick your brain about verbs.
00:52:29.06
Chris Morrell
Some, if you're interested in going down into the specifics a little bit, how's that sound to you?
00:52:33.66
Shawn McCool
Yeah, I'm interested. I'm i'm i'm not ah nearly like familiar as you are, of course, but I'm i'm not super familiar with the details. So you might have to hold my hand a little bit.
00:52:44.36
Chris Morrell
Yeah, yeah, no, i'm I'm happy to. And I don't expect you to, yeah. um I mean, so ah i'll I'll give the just like the 30-second, which will probably end up being like four-minute overview. um the main ah The main thing that going into verbs um I know I wanted to solve and I think I can speak for Daniel that this is true of him too is when, when writing a, I would say medium sized application, uh,
00:53:25.48
Chris Morrell
in what I, what, in my mind is like a traditional event sourcing sort of paradigm.
00:53:32.77
Chris Morrell
you just get into this this horrible place of, okay, you know, I want to introduce and a new interaction in my application, right? We'll go back to the the user promoted to admin event, right? So in in this it ah application that I was working in, or um in that case, you know, like, ah ah Question skipped is an actual event, like it's an exam system, right? So when a question is skipped, ah we want to, we or we want to introduce a feature that allows someone to skip a question and come back to it later in the exam. Okay, so I go and I create my question skipped event, right? That holds the data of the event.
00:54:20.53
Chris Morrell
Then I go into my aggregate root or I go into somewhere to write the the um code that's responsible for firing this event. right And that code has to do maybe some guarding against, ah you know it it has to basically query the decision model and ask, is this event allowed to fire?
00:54:44.58
Chris Morrell
it has to ask, you know, is this person authorized to fire this event? It it does all the guards against um this the state and then fires the event. And then elsewhere in my aggregate route, I have to add an additional function that ah listens listens for the event and updates the um aggregate with any additional data that it needs to track for future events, right? So, okay, we're up to three places.
00:55:10.35
Chris Morrell
Then I have to go into a projector somewhere and add any projection logic around, okay, what's the what's the ah database state that needs to be updated for my exam system UI to actually reflect the fact that the question was skipped. And then maybe not in the question skipped context, but in another context, maybe I have another place that I go into a reactor that It's going to fire off an email when this event first happens, but won't actually won't ah run again if it's ever replayed. right So for this one interaction, I've gone into i've created a new file. I've created one, two, three, four new methods on on three separate objects.
00:56:02.22
Chris Morrell
um all to represent a singular thing. and And this is something that I'm curious if you agree with me on, because in my experience, there's almost always a primary effect of an event. You may have um you may have secondary um projections that that like other parts of your system care about, and it depends on the type of event. Sometimes you may have an event
00:56:32.90
Chris Morrell
that a bunch of systems care about deeply, and there really are um a number of major effects that that are the result of that. But you know the example of questions skipped, right really the only thing that this event is there for is to represent the fact that they skipped this question. um There's not a whole lot of other parts of my system that care about that one event.
00:56:56.70
Chris Morrell
um And so I just found myself really frustrated by the amount of boilerplate that I ended up writing for every single individual interaction that happened within my application.
00:57:09.58
Chris Morrell
um But before I go on, does that premise ah resonate with you at all? Like that idea that there's often really one main outcome ah from many of the events in an evented application?
00:57:29.19
Shawn McCool
I think that I might be able to get behind it. ah The way I think about events is so much the idea that they are reflected on by any amount of observer.
00:57:42.97
Shawn McCool
And so in my heart of hearts, all I can think is I don't want to elevate one type of thing above another because to me they're all equally decoupled, right? um But if if you're talking about like, let's just talk about event sourcing a model, not worrying about like some kind of contract that communicates between other systems, right?
00:58:01.43
Chris Morrell
Sure.
00:58:01.86
Shawn McCool
But if we're just talking about like the internal events of this model, yeah, I think that it's it's not uncommon that you use the event of for changing the state of a state machine.
00:58:12.00
Chris Morrell
Yep.
00:58:13.91
Shawn McCool
Like there's a conceptual state machine and you want to go from one state to another and that usually has like maybe one major reaction, right? And so I think this is what you're talking about and and I can get behind that, but there's like a part in me that's screaming that events are to be heard by everyone or by whatever scope you're defining them in and all of the listeners in those scopes are equal, but I think I can get behind it.
00:58:38.29
Chris Morrell
Yeah. Well, and I think that you're, you're fundamentally right. And I think that like any system that doesn't, uh, allow for that reality, I don't think would be, uh, a nice one to use. Um, but I think that like in practice, that's been my experience at least is that more often than not, um,
00:59:03.90
Chris Morrell
You know, I have this sort of like primary outcome and then maybe, yeah, maybe I have some sort of like analytics use case that's also paying attention to that event and is projecting data into some sort of analytics, analytical database or something like that. And I may have.
00:59:17.84
Chris Morrell
You know, I might have a bunch of other sort of observers that do care about the event, but they're kind of like secondary to the, the the maybe maybe even secondary to like the user intention, right? The user's intention is that that question is skipped and maybe my application cares about the question skipped event in a bunch of different ways. I don't know if that's exactly it, but Um, anyway, so that's, that's the, that's, that was the, like, the starting point was just, I really love, I really love this mental model, but I, it kills me every time I have to introduce a new event into my system because I end up writing so much boilerplate, um, over and over and over again.
01:00:10.43
Chris Morrell
It's like, okay.
01:00:10.71
Shawn McCool
Is it boilerplate though? like ah So you implement a new event. Now your system it has the idea of a thing that can possibly happen. Then you implement the dispatching of the event. Now the system has the observe observation of that thing possibly happening. Then you update a projector and that projector interprets that event into its own context and now There is another actor within your system that it is viewing and perceiving this event So to me it's like this is cool because all of these tasks can be done Completely separately like from one I'd like you can do one and deploy it you can do one deploy it They're all really really isolated. It's really easy to plan. It's really deterministically planable right like you have a good idea of how much work is involved with it and It's very also prescriptive. You have a recipe you can follow It doesn't feel like boilerplate to me, but I might be misunderstanding you
01:01:01.73
Chris Morrell
Well, I mean, I think conceptually I agree with you. Um, but in practice, I know my experience was, I hate this every time I do it.
01:01:12.02
Chris Morrell
I hate it. You know, like I think in, in, in theory you're a hundred percent, right?
01:01:13.63
Shawn McCool
Yeah.
01:01:18.49
Chris Morrell
And there are moments when I really, there are plenty of moments when I did fully appreciate one or all of those facets of of the experience. You know, there are, I think some of the most powerful um moments in my sort of like journey along event sourcing were times when I realized, oh, I can just start firing events and not worry about the the the outcome at all right now, right? like and Or just, yeah, in terms of planning the rollout of a feature, being able to separate those different components of the process into different ah different parts of the release. I 100% agree with you there, um but I still know that my experience was
01:02:08.46
Chris Morrell
especially when I'm just like deep in a feature and trying to like, you know, when, when all I care about is that the person clicks skip question. And when the page refresh refreshes, they're on the next question in the exam.
01:02:23.51
Chris Morrell
um It, I just, I hated it every time I hated every time I had to open those four files and add multiple methods to some of them. And, and it just, it just drove me nuts, you know? Um, and I think that, I think that to some degree that's like, uh, it's very much a Laravel sort of, um,
01:02:50.64
Chris Morrell
What's the word I'm looking for? There's, there's a, there's a, there's a very low tolerance, I think in the Laravel community for, uh, anything that doesn't feel good.
01:03:01.40
Chris Morrell
Right.
01:03:01.36
Shawn McCool
many Many files. Hey, I have like six files here. Can I can i make it one file?
01:03:06.23
Chris Morrell
Yes. Yeah. I mean, it's, and I appreciate that that's to some degree, that's just like part of the the vibes of this ecosystem that I'm in. And like.
01:03:15.35
Shawn McCool
Well, it's like ah it's good to have like forces pushing against each other. like Design is navigating these these like forces that are competing with each other for your specific circumstance, right?
01:03:26.33
Chris Morrell
Yes, yeah, yeah, for sure. um And so when we set set out to build verbs, you know, there wasn't there wasn't like one specific technical need that we were trying to address. um And there there weren't even like, I can't even remember like specifically, oh, you know, I want,
01:03:52.90
Chris Morrell
I wanted to work ah this specific way. I've always wanted it to work the specific way and it doesn't work this way and that bothers me. It was more just like, I want the ergonomics of like the primary use case for me to be better, right?
01:04:07.98
Chris Morrell
I want the like developer experience to feel better to me.
01:04:09.88
Shawn McCool
Yeah.
01:04:11.55
Chris Morrell
I want this to feel more true to like the Laravel ecosystem and the vibes of like the Laravel community, the the like the taste of the average Laravel developer.
01:04:23.00
Chris Morrell
Um, and what, what we ended up coming down to was like, why can't you just encapsulate like every piece of this sort of like primary use case into one file? Um, because, you know, I think, uh, a.
01:04:45.71
Chris Morrell
um a value that has been emerging in the Laravel community. And I think in general, a value that's been emerging in a lot of the like modern programming communities that I'm part of is co-location when that's a good thing, right? I think there was like a really hard push away from co-location at a point in time in sort of under the banner of separation of concerns that I think that there was just like a, there was, there was like a blending of, of ideas that ended up pushing people to, Oh, we have to put everything in its own place.
01:05:30.03
Chris Morrell
Even if a hundred percent of the time that I change one of these things, I need to change another one. Like they need to be in their own places because that's the right way to do it.
01:05:38.75
Shawn McCool
Yeah.
01:05:40.93
Chris Morrell
Um, And so I think ah all of that conspired to to kind of just get us to this place of like, what if I just have a like question skipped event that has a handle method on it that writes to the database. And if I need to validate whether that event can happen given the current state of the world, I put a validate method on it.
01:06:08.35
Shawn McCool
Yes.
01:06:08.58
Chris Morrell
And I have to authorize if that can happen based on the current like logged in user, I put an authorized method on it. Um, and if I get to the point where this event, uh, like has many observers and there isn't sort of like a single, like official, uh, you know, handler, I can move that stuff out into dedicated projectors. I can, I can.
01:06:33.59
Chris Morrell
go with like the more traditional approach if I need to, but like, especially for early rapid prototyping and for events where it really is just like, there's, there's just mostly just one use case now.
01:06:48.74
Chris Morrell
To make a change, I just change one file and if I need to like remove this event, right, for some reason, like or yeah not necessarily remove the event but if I need to change something, I just have one place to go to change, you know, I have all the context for the most part in one place.
01:07:04.46
Shawn McCool
Sure.
01:07:09.18
Chris Morrell
um that that became sort of the driving force or sort of like the the star that we were aimed at for verbs.
01:07:19.94
Shawn McCool
Yeah, I mean, I think I get where you're coming from. I would say that there's a lot of what you're what you're talking about that is like dirty, like like dirt dirty software design in a way that to me, I'm considered dirty in that way.
01:07:27.50
Chris Morrell
Mm-hmm.
01:07:32.26
Shawn McCool
Like I like to question why are these things structured so ornately? Like did we need like a Baroque?
01:07:42.77
Shawn McCool
a structure in our application like ah I had this idea forever ago. What if I just make my command like I like the command bus right? I like being able to say this is a unit of behavior that I want to run and then I have a command pipeline run doing logging and metrics and tracing and stuff like this on this. So whenever I have a new service behavior I can implement a command and I immediately benefit from my pipeline. So this is something that works for me. I've heard a lot of people have a negative view of that. That's fine.
01:08:10.77
Shawn McCool
um But I had this idea of i'll I'll construct my command with the constructor, and it'll store the properties in in this object. But I'll have a handle method on the object which will execute the command. And what I can do is I can drop the command to the pipeline. All the same things happen, but the very last piece of the pipeline just calls that handle method and reflects on that method for dependencies and injects the dependencies into that handle method.
01:08:36.66
Shawn McCool
and everybody's like, this is the most disgusting thing I've ever seen. But I promise that in my application, it was like the the properties of the command and the execution of command all in one place. ah it It seemed like it couldn't be more simple. so This is not something that I think works in every environment, but I love when people are willing to commit to something that's kind of dirty and in this way.
01:08:58.74
Chris Morrell
Yeah, no, I, that's a hundred percent right. Yeah. Uh, we, I, I recognize that, uh, to, to a certain I, this is like everything bad, ah you know? Um, and I don't really care, you know, it's like, it works, it works well. Um, it feels architecturally sound, you know, when you actually use it. Um,
01:09:27.00
Chris Morrell
it It makes code review feel glorious. um It makes discoverability really solid, right? It's like,
01:09:38.53
Chris Morrell
um You know, this is a thing, this is another thing that I, I'm a particular believer in is, um, you know, uh, Laravel applications follow ah a very specific, like sort of conventional pattern in terms of like the, just the structure of the file structure of the application. Right. Um, and.
01:10:02.17
Chris Morrell
For us, you know our application is is pretty large. you know it's like ah it's it's It's trending into the million line of code ah region.
01:10:14.71
Chris Morrell
um And being able to break things out into individual modules that like share a common domain, um not necessarily ah not necessarily being incredibly strict about that, but just like knowing that if I need to figure out something that's going on in our billing system, I open up the billing module, right? If I need to figure out something that's going on in exams, I open up the exams module.
01:10:45.72
Chris Morrell
I, oh, I lost your audio.
01:10:50.17
Shawn McCool
I'm sorry.
01:10:50.39
Chris Morrell
No.
01:10:50.61
Shawn McCool
i it's It's just about what's cohesive, right?
01:10:53.09
Chris Morrell
Yep.
01:10:53.06
Shawn McCool
These things go together. Other things don't go together. Why not stick them together where you can find it?
01:10:57.55
Chris Morrell
Exactly, yeah. And I find that this approach with verbs feels very much the same. It's like, when I need to understand the the process that that happens when a user skips a question, I just open that one event. And I can read it top to bottom. you know Our are coding standard is that like the methods on the event are ordered in the same order that they fire in like the lifecycle of verbs. So you know you just read down, authorize, validate, apply, handle. You have all of that context. And it feels like a really, really nice approach to this so this problem. um And like I said, if if you end up
01:11:47.62
Chris Morrell
having, for example, like ah an analytic system that cares about a bunch of different events and needs to project them into some other place. You just register an analytics projector into this into the system and it just tells verbs which events it cares about. um And it can also listen to those events and and do something else when they fire. um But that's like a separate process.
01:12:14.55
Shawn McCool
Sure. So I imagine you could structure your application.
01:12:15.72
Chris Morrell
um
01:12:18.33
Shawn McCool
So wherever is the authority for raising that event, you will co-locate kind of the the the consequences of that event being dispatched in that area.
01:12:28.82
Shawn McCool
And then if you have like another system that that is like not directly related to that context, you might choose to have a more separate like listener or something that reacts to that.
01:12:39.60
Chris Morrell
Yeah. A hundred percent.
01:12:41.25
Shawn McCool
That way you're not mixing all of these pieces, all the different contexts together.
01:12:42.12
Chris Morrell
Yeah.
01:12:45.95
Chris Morrell
Yeah. Yeah. It lets you have those boundaries when you need them. Right. And kind of have that more abstract, like, um, everyone listens to all, all the events that they should be able to listen to and can independently do what they like with them.
01:13:04.00
Chris Morrell
But it also has the advantage of like in the places where there's like one very tightly coupled system that cares about this event. Like you're not, uh, you're not spreading that around, even though it is still coupled, but now it's like across a bunch of different pieces of that system, you know?
01:13:24.68
Shawn McCool
Yeah, so i'm I'm really fond of kind of ah good jumping immediately into the deep end of this whole thing and like spreading things out and and and working with it that way that might have to do with the fact that I've been working with event sourcing and production for like almost 10 years now or something like this, I don't know. ah But when I see frameworks, like whether they do things the way that I like to do them or not, but when I see that, okay, they acknowledge that here are some concerns. Concern one, like maybe we're talking about locality, right? Concern two, so locality can be reflected on here as there are changes that you're directly tying to your event. ah
01:14:04.66
Shawn McCool
and you want to put it all together or you want something that that's less local and you have a listener in another context listening to it. But to to acknowledge that these circumstances exist and to give a route for the developer to be able to make the selection for themselves, that to me is as long as those things are are provided, that that those are great features and what's the worst that that can happen? right ah I think it's really cool to create more models for this kind of stuff. I think that you don't need to worry about like like the old guard who had who had their specific ways that they they use all the time. ah That's not really interesting. What's interesting is getting a whole lot of people involved, trying a bunch of stuff. Maybe some of it doesn't work, maybe some of it does, and then learning from that, right?
01:14:54.23
Chris Morrell
Yeah. um i have Okay, I have two different paths that we can go down and um I want you to pick. um the The one thing that I have been curious to get your take specifically on um is I am tempted to, or I'm i'm feeling like the sort of neck um the next stage for verbs is perhaps leaning further into
01:15:28.62
Chris Morrell
um this reality that this is like, this is a system for the typical Laravel app, right? ah That it works, it's it's built to work generally with a you know ah ah traditional relational database. um And it typically happens synchronously. um And I think that there's there are some interesting things that we could kind of like,
01:15:59.70
Chris Morrell
consider that in the abstract maybe would make some folks very angry, but um ah even things like you know what's stopping us from providing some good tooling that lets you um reflect on existing events, maybe you know provide some sort of like,
01:16:28.73
Chris Morrell
ah ppe attributes that that provide data about like a the migration from like different event versions, for example. And then just like have it have a command that lets you ah run through the and but entire events table and just update past events to reflect the new changes, right? Like that's something that's always been a little bit, I have, i have tended to treat the events table as like this sacred place. but Not entirely. um We've done a lot of like sort of um pushing like synthetic historical events into into the ah event store, um which has has been really powerful for us. But in a lot of ways, I try to sort of
01:17:21.44
Chris Morrell
have this mental model of like, okay, once an event's been written to the, to the database, like that's the reality and any changes have to happen in future events. Right. But like. I think there's like an interesting question of sort of what other um rules could we break, as it were, if we kind of like constrain ourselves right now to um just like thinking about verbs as a tool for a sort of traditional um or, you know, ah a modern Laravel application.
01:17:55.30
Chris Morrell
um
01:17:57.87
Chris Morrell
i would that that's That's option one, or if you just want to go down that path, we can.
01:17:59.94
Shawn McCool
OK.
01:18:03.27
Shawn McCool
well Well, I. I have thought so. A lot of these these principles like the immutable immutable events tour, right? These principles are there to prevent like foot gunning right there. They're there to deal with practical concerns more than more than philosophical concerns. Like let's say let's say you know you re rewrite some of your event streams.
01:18:27.38
Shawn McCool
at at ah at a reasonably low scale, really low um risk in general. If you feel like you can re-project or you don't need to re-project, right? If you feel like that there's no issues with this, that's fine. um But I think a lot of the... the understanding of these approaches is based on significant experience in a wide variety of circumstances leading people to certain generalized patterns. And it's not that you need to adopt these generalized patterns, right? Because maybe if you
01:19:02.07
Shawn McCool
If you say, I'm not going to support all patterns or are are all circumstances rather, I'm not going to support all circumstances. If you're processing 100,000 events every like 30 seconds or something like that, maybe that's okay.
01:19:11.16
Chris Morrell
Yeah.
01:19:15.76
Shawn McCool
I don't need to deal with that right now. Then you can make different trade-offs. right and You can optimize for things that others are not optimizing for to get advantages that others don't have.
01:19:20.52
Chris Morrell
Yeah.
01:19:30.87
Shawn McCool
I work on a transaction processing system. and so I tend to be a little bit more like old-school in my value set when it comes to the system because I know that if I start to get in and like I demand a huge amount of historical data in my event store and I start rewriting it, that the the cost of re-projecting is going to be significant to me.
01:19:50.02
Shawn McCool
and to my team. and and And I have to make decisions about the how the system's built with these considerations in mind. But in a different context, like my previous company, there was no way I was going to have scale like anything like this. So I could i could literally just decide myself, I would have a a way to cursor over and stream ah events from the event store, function, Lambda function, it takes the event, it says, okay, if it's of event type this, return a new event, that's the same exact one, but with slightly slightly different data, because I'm making a correction, and then save it, that's something I've done with no consequence because I understood the circumstances I was in. But there are limits to this kind of thing, right? ah if If you're
01:20:36.41
Shawn McCool
ah willing to accept this, then I think that it's fine. But I think it would be really cool also if you're going to go down that route to really make it clear these are the limitations of this. You know, if you can really communicate those effectively, then that can help people make a decision. And I definitely think that there is a middle like middle tier of an application that's not like a super big application. maybe yeah I don't know, like maybe if we divided the size of a a scale of an application or or if it's traffic or whatever relevant metric it is into like five pieces. If you're like in one, two, or maybe three, you can get away with certain things that are kind of like murder in the rest of them. I say that's pretty cool too, maybe.
01:21:19.39
Chris Morrell
Yeah. Yeah. I mean, that's, I don't know. That's my, that, this is kind of what we were talking about on your stream is like, um, I feel like, you know, we, we deal with, uh,
01:21:36.88
Chris Morrell
decent scale, right? We're not, we're not, we're not PayPal, right? We're not blue sky. um But we, you know, we have data from hundreds of thousands of users and, and, um you know, at different points in time, you know, we will have people lots of people taking exams simultaneously and having to communicate data about those exams to ah dozens of different ah state licensing bodies per person. and you know like It can scale out to a place where we have to at least think about it a little bit. right It's not like ah at that point in the application where you're just like,
01:22:23.81
Chris Morrell
you can kind of just do whatever doesn't matter, right?
01:22:24.66
Shawn McCool
Yeah, Wild West.
01:22:26.67
Chris Morrell
um But even at that scale, which I think is like, um I think is like a as ah as a formidable target for many like applications, right?
01:22:40.99
Chris Morrell
For a lot of people, if you get to hundreds of thousands of users, you're gonna be quite happy, right? Like that's gonna be a successful business. um Even at that scale,
01:22:54.58
Chris Morrell
I think we can get away with a lot of these more naive approaches to um how we manage our events. And so it feels to me like potentially leaning into that even further. Like you said, we might be able to find some Um, serious advantages there, right? Uh, where the disadvantages are unlikely to impact folks until they're at a point in time in their applications, like life where they're.
01:23:29.86
Chris Morrell
having to deal with those problems in a bunch of different ways, and like you're going to have to you're going to have to think about re-architecting, finding new approaches to a bunch of different things, and this will just be another one of them. That's that's what I'm leaning towards right now. um And obviously, I don't want to go too far down that path. right I don't want to like lead people down a path that they're gonna quickly come to regret. um But I think there's something interesting there ah if we kind of like allow ourselves that ah that that constraint, you know?
01:24:04.98
Shawn McCool
Yeah, um so I think if you say, hey, look, you want to rewrite some events, you want to correct some events, here's this tool to do it. Warning, this isn't going to reproject all your projections.
01:24:16.19
Shawn McCool
Warning, this isn't going to whatever. ah Use it your own discretion.
01:24:18.93
Chris Morrell
yeah
01:24:20.92
Shawn McCool
I mean, either it's perfectly valid. What's the problem? like The kind of traditional approach that like people bring up is stuff like, let's just re-project the entire event store into a new event store and then ah blah, blah, blah. like like there's there It's not any simpler.
01:24:37.80
Shawn McCool
like the if you know Having opinionated approaches with the tooling to support that, that's the tooling is is everything. like I've written a projection manager that's able to reproject projections. I've written a projection manager that doesn't... I don't write layer of L migrations, for example, for a projection. I use the migration as a custom part of a projection component.
01:25:00.48
Shawn McCool
so that that projection component can just spin up a new projection with a different database table, if I'm using a relational database, while the other projection is still running. and Then I can just switch them over.
01:25:09.73
Chris Morrell
yeah
01:25:11.21
Shawn McCool
right like if you can make this You can make it data-driven, you can do all kinds of stuff, ah but the tooling has to support it. If you're doing it all by hand, it's going to be exhausting and laborious and there's going to be a high chance of error.
01:25:23.51
Shawn McCool
But if you can make these tools and you can make them work and make them easy, then more power to you.
01:25:28.26
Chris Morrell
Yeah, yeah, I think, I mean, I definitely agree with that. I think that like um the tooling is obviously a big piece and and that's something that we you know we've been um focused on is like, it has to be well supported by the framework and that that we have to give you ah as much ah a highest chance of success as possible, right? um The other topic that i I've been thinking about a ton and honestly like
01:26:04.91
Chris Morrell
There's, there's a tiny part of me that wants to, uh, re-architect all of the, uh, verbs ah event store to sort of like lean further into this is, um, another topic that came up on your stream.
01:26:17.27
Chris Morrell
Um, I can't remember, I can't remember who it was who brought this up and I'm, I'm even blanking out on the the exact term, but like the, uh, the, the idea of like dynamic consistency layer, or is that, is that what it was called?
01:26:29.11
Shawn McCool
Yeah, it's dynamic consistency boundaries. it's it's ah It's a concept that's really pushed by Sarah Pellegrini, and I believe she has a presentation called Kill the Aggregate, I think is is what it's called.
01:26:39.77
Shawn McCool
So you can just search for Kill the Aggregate, and you'll find her presentation online.
01:26:41.79
Chris Morrell
Okay.
01:26:44.75
Chris Morrell
Um, that, that whole idea just really, really resonated with me. um
01:26:54.71
Chris Morrell
One decision that we made about that we made with verbs was that um we wanted to let ah events be associated with multiple states. right that that it it wasn't That there wasn't in the event sourcing package that I had been using, there was very much like a one-to-one relationship between an aggregate and an event.
01:27:16.22
Chris Morrell
um and that never That never was a huge constraint for me, I found. um But it Daniel definitely bumped into it a lot and he advocated for it. um i wasn't I wasn't a huge believer until we kind of like got down this path a ways. um But now I really do appreciate that like for certain types of systems,
01:27:46.74
Chris Morrell
um There's like a bunch of different types of decisions that that are all fairly isolated from each other that happen around different events right, especially if you're like talking about a game, right, the, the, the game rules kind of have a whole subset of rules that relate to like the the player right and then you have rules about the board state maybe and you might have rules about like the players uh like the the the player's hand right if it's like a card game and all of those
01:28:21.70
Chris Morrell
impact the the question of like, are they allowed to like make this move or play this card or do this action? um But they're all fairly isolated ah decision context, right? There's like a rule about what what size a player's hand can be, right? And that's fairly separate from like the rules about, you know, can this card be played at this particular time on the board, right?
01:28:47.43
Chris Morrell
Um, and so I think the i idea of, um, you know, splitting your decision decision models up into these small chunks, right. And letting your event be associated with as many different, um, uh, different states as, as you need, um, feels really good. Um, and.
01:29:15.59
Chris Morrell
The thing that came up ah in in your stream that really struck me was if you, because right now our system is coupled to states and state IDs, right? So like you would have like a board state and a player state and a hand state maybe, right? In that but example. um And each one of those has to have like a globally unique ID in the system. And you reference each of those by that ID.
01:29:43.45
Chris Morrell
um But the idea of being able to just like have your states be associated with potentially like just an arbitrary string, like a username, um like a an arbitrary globally unique thing that like lives in the world. Another good example that came up ah is like a URL, right? Like if you're if you're potentially ah building a system that's maybe crawling a site and needs to like,
01:30:14.20
Chris Morrell
hold some data about whether a page has been crawled or whether an error has been, ah you know, whether whether we've hit some sort of error threshold on like retries is on a given yeah URL or something like that. um This idea of opening that up even further to just like, yeah.
01:30:34.32
Chris Morrell
ah You may have some IDs that are just like a UUID, but you may have other IDs that are a username or a URL or a timestamp or, you know, anything that's sort of just like globally unique.
01:30:50.45
Chris Morrell
has kind of like set my brain on fire.
01:30:52.30
Shawn McCool
Yeah.
01:30:53.76
Chris Morrell
ah I'm curious your thoughts there. I know we're close to, or we've we've kind of hit the end of the time we allotted. So I also want to, um I can keep on going, but if you need to to jump, like I don't want to take up too much of your time.
01:31:06.52
Shawn McCool
Yeah, maybe we could like ah ah talk about this topic for a minute because I have a couple of thoughts. um Specifically, I get the urge to have arbitrary queryable event stream so that you can say, I wanna make a decision based on arbitrary boundaries, right? And there's there's ways to do this already using like the aggregate event stream approach. um and Now I'm not passing a judgment on the dynamic consistency boundary concept. I'm definitely not doing that, but it's worth noting that for example, have you ever coupled
01:31:41.67
Shawn McCool
I don't know how what your experience with aggregates are, but have you coupled two aggregates together? um Because you can definitely couple aggregates together. and so I've done ah some game development with with event sourcing because game development is one of my hobbies. and Of course, the second I drop into them, I'm like, how can I do this with event sourcing? and like What are the ramifications of that? and One of them is you can pass like one aggregate into the method of another,
01:32:07.17
Shawn McCool
and have them interact in this way. so ah You might have the concept of, ah let me think of how how to map this. I'm just going to go ahead and say, ah you might make a charge against a transaction intent, and that charge will will be to charge somebody money. But for each transaction intent, you don't want to make two charges.
01:32:27.31
Shawn McCool
right So how do you model that like so that, because each tra each each charge has its own lifecycle, it doesn't know about a previous attempt. right So I might have an aggregate that's a transaction intent aggregate, and I hate the word aggregate, and I might have a charge that's like a charge that that is an aggregate.
01:32:36.42
Chris Morrell
No.
01:32:45.99
Shawn McCool
So when I create a new charge, I pass in the transaction intent that I that i intend to to use it. And inside that method, I'm saying, hey, transaction intent. i want to i'm I'm going to begin a new charge now, and here's it the my identifier.
01:33:00.12
Shawn McCool
And that aggregate can say, oh, I already have a charge attempt running. I'm going to completely deny this going forward, right? So it throws an exception or however you want to do it.
01:33:11.46
Shawn McCool
And it prevents this from happening. And so this is this is one way in which you can have multiple things tie together. And then what the outcome of of that is, is the transaction attempt has its own history. Like, oh, here the intent was registered, a charge began, um and then ah yeah it has it it has ah its own perspective on the other charge. It knows when the charge began, and it has its completely separate event stored in its own event stream.
01:33:38.09
Shawn McCool
about that event. But in in the charge itself, it was like, oh, charge requested or something like that. it's it's ah It's a different perspective on the same occurrence. So that's like one way that we can get this kind of outcome, which is literally just to bring these models together, not dissimilarly to how you would do any any two objects.
01:33:57.82
Chris Morrell
Sure. Yeah. And like I said, that's been kind of my experience in our existing application, the places where that, that has come up.
01:33:58.75
Shawn McCool
And I've, yeah, go ahead, sorry.
01:34:08.48
Chris Morrell
ah There have been solutions that have worked and it it hasn't been a huge problem for me. So at first I didn't see this as like a particularly important like a pursuit.
01:34:20.04
Chris Morrell
Um, so yeah, I definitely appreciate that there are are other ways to approach this problem.
01:34:27.94
Shawn McCool
You also have this idea of like ah there's a dynamic consistency boundary. And it's like, for for example, I think you use username as an example. So let's say ah anything that's happening to a user, those can be happening in any stream. right But they're tagged to a user. So you can query it as a new stream with with the stream ID that username, or for example. right um This is like the the kind of the the fundamental nature of the dynamic consistency boundary, which is anything that's queryable in the event store that returns multiple events becomes a stream in itself.
01:34:57.44
Shawn McCool
and ah One of the ways that people have done this before is that um as part of an automatic system, they they project ah references to events into its own stream. so like You can just arbitrarily create streams and reference those events. as like You could think of them as links or pointers. so They fill the the the spot an event would fill, but your system already knows that, oh this is a reference. I'm going to go grab those references that construct the stream and send it to the application.
01:35:26.82
Shawn McCool
and it can do that without duplicating the data with just having a little bit of extra data for that that pointer. ah That's another way that this has been solved. so This to me is very similar to the dynamic consistency boundary concept, ah but it's a little bit more structural.
01:35:35.22
Chris Morrell
Mm hmm.
01:35:42.51
Shawn McCool
You have a structure in your event store that that points to all the different events with that event stream, Whereas the dynamic consistency boundary, it feels like you're constructing a query that will have the outcome of querying in this stuff. So youll you'll have to decide. that One of the the challenges that you have to face with this, though, is that when you have aggregates and event streams, it's very easy to identify on what scope you want a some kind of lock to exist. right so if you're using And Bastion, a gentleman I never met before, but
01:36:17.44
Shawn McCool
ah came on the stream to talk about this on my stream. He he mentioned, okay, there's a mechanism for doing an optimistic locking here. And then people who are doing pessimistic locking, they have yeah they have to define a key around which they're locking. So a normal way of locking might be saying, oh, um I'm attempting to process this transaction, maybe I'll lock on the transaction identifier.
01:36:41.69
Shawn McCool
ah But with the dynamic consistency boundary locking ah on a key becomes a problem because you you know, how do you lock a resource? um Such that you know that this resource is being locked whenever wherever it's interacted with.
01:36:57.60
Shawn McCool
So I think that Sarah and maybe her collaborators, I don't know exactly who's working on this, but I know Sarah was a major advocate of it.
01:36:58.22
Chris Morrell
Super.
01:37:07.04
Shawn McCool
They might have had they might have come up with a good optimistic locking strategy that may work, ah but i I personally have not ah become fluent enough in it to really be convinced that this is the strategy that I would move forward with. But I think that if you would if you explore this and if you identify that this is like really meaningfully, like it gives it gives you liberation to to explore new ways of handling this, then I think that's great. i The last thing in the world I want is for people to stand on dogma and you know and and not make progress here.
01:37:42.84
Chris Morrell
Yeah, I appreciate that. yeah so how like ah the The question specifically of like you know how do you ensure the uniqueness of a username in an event source system?
01:37:54.83
Chris Morrell
um comes up a lot in like the verbs discord. you know That's like a question that people come up to.
01:38:00.11
Shawn McCool
Yeah, of course.
01:38:03.09
Chris Morrell
My answer up until now is like you know you just need some sort of reservation system ah or you know some you need to solve this some ah in some other way. right
01:38:13.14
Shawn McCool
Yeah, that's a valid approach, right?
01:38:13.76
Chris Morrell
that Um, because you're not, it's not like you're going to have, uh, an aggregate that just holds every single username that's ever been registered in your system. Like that's just not, it's not a ah realistic way to approach this probably, you know.
01:38:30.26
Shawn McCool
Well, like what is an aggregate, right? Like it's an in-memory projection. You don't have to have an in-memory projection. You can write it to a database. Is it so bad to have a database table that is just every single username you have, for example?
01:38:40.00
Chris Morrell
Great.
01:38:41.21
Shawn McCool
So um if if your system allows for configurable, immediately consistent versus eventually consistent projections, then you can have in certain interactions like immediately consistent projections for these things, right?
01:38:54.73
Chris Morrell
Yeah, and I think that that that gets it. I think for a lot of people, um
01:39:01.99
Chris Morrell
it's easy to get into this mindset of, okay, all my projected data should be disposable, right? um and And I do think that that's like a useful ah mental model of of like sort of enforcing this like read-write ah ah boundary is if you kind of like have this general mindset of like, okay, all of my, the only thing that matters is the events, right?
01:39:29.70
Chris Morrell
Everything else I could theoretically throw away and re-project. And so when you have that like mindset, then the idea of relying on a user names table, um I mean, even there you could, you can kind of just re-project it and yeah.
01:39:43.34
Shawn McCool
It's the same. It's the same as an aggregate. It's just not in memory because it's not practical to be in memory.
01:39:47.61
Chris Morrell
Right.
01:39:49.41
Shawn McCool
If it was practical to be in memory, it would just be in memory.
01:39:50.41
Chris Morrell
Right.
01:39:51.73
Shawn McCool
And who cares? But like the difference is like with projections, we usually think them ah think of them as purely eventually consistent.
01:39:53.04
Chris Morrell
right
01:39:58.44
Shawn McCool
So um you're not, you you either, This is why the uniqueness problem is a problem because if if two users sign up at the same time with the same username, the check occurs. and the but The first user who who was there first just simply hasn't had theirs written yet. That's a race condition. That's ah that's a fundamental problem. so Now what do you do? There's usually a like a line blocking mechanism that's necessary. Let's block at that Let's create a lock for this resource. and If you try to access it, you just you'd just wait your turn and then you get to go. right But nobody wants to have the entire system locked up because everyone is creating new accounts and it's it's dealing with this thing. so Why not just have a projection and write it to a database table or any other, like Redis, who cares? like Whatever can handle the problem and just say, hey, I'm going to do this either inside the same transaction if it's in the Datastore.
01:40:53.55
Shawn McCool
ah Or um Yeah, like like yeah, just putting the same days or like this is this is a limitation that you're applying to yourself in this kind of problem, but It solves the problem also I mean it it opens you up to a few things it opens you up to slightly higher risk because if there's a problem with this right or something then the the process can fail or whatever but um Like traditionally, I would just say, hey, just have an interface, have ah something behind it, and have a service that's dedicated to unique emails. And I don't care how you write it, right? It's just an interface at this point. So whenever you say a member registration aggregate, you pass in the properties of that member, you're also passing an instance of that interface ah that is able to handle that uniqueness.
01:41:38.25
Shawn McCool
and then inside your aggregate, it integrates with that domain service to make the decision of if this is a valid user. That's how I would generally say it, but what's behind this interface or what's happening back there doesn't matter as long as you can rely on it being immediately consistent.
01:41:53.80
Chris Morrell
Right, right. Yeah, I mean, and the the goal or my plan had always been to essentially ah either provide a built in, built into verbs or a first party package that adds support for some sort of you know database based uniqueness, maybe not even purely uniqueness, but like i I feel like in general ah being able to reserve unique values and being able to keep an ongoing count essentially are just two things that come up over and over.
01:42:30.34
Shawn McCool
Yeah, global global constraints basically.
01:42:30.65
Chris Morrell
And I thought, Yeah, exactly. And if we just provided a built-in service that supported that, I think that that would ah help a lot of people out. But I just got kind of excited about this idea of, oh, but if you just treat the username as its own state,
01:42:50.74
Chris Morrell
You know, then you can just track. Okay. Does, has this username been registered? Has this username been banned?
01:42:55.91
Shawn McCool
Yeah.
01:42:57.35
Chris Morrell
Has this username been, uh, migrated to a new username transition to an email address based like login, you know?
01:43:03.42
Shawn McCool
But what's the downside? what why Why wouldn't you do this? What's the downside?
01:43:08.16
Chris Morrell
Um, well, I mean, I think the big downside is it introduces some complexity in the event store, right? Like you, you end up having to, um,
01:43:23.01
Chris Morrell
you have to You have to think about how you're modeling the system that stores and retrieves events differently. You have to think about like key indexes.
01:43:33.32
Chris Morrell
like I think that there's there's a there's a bunch that comes down to like verbs would have to solve this problem well.
01:43:40.67
Shawn McCool
Mmhmm.
01:43:41.99
Chris Morrell
um But i think I think that if verbs solve the problem well, the main downside to the end user maybe would be around the locking question, but I even think that the the framework could provide a solution to that.
01:43:57.61
Shawn McCool
I would love for your framework to like just say, hey, look, this is what you're going to do. If you want consistency, you're using the same data store, and we're doing optimistic locking, we're doing it for you.
01:44:08.61
Shawn McCool
And that's just how it is.
01:44:08.72
Chris Morrell
Yeah.
01:44:10.20
Shawn McCool
um But but i the one problem I see, for example, is like when you start
01:44:10.49
Chris Morrell
Right.
01:44:15.23
Shawn McCool
This may not be even something you're interested in, but if you start partitioning your event store, right now you have to have those kind of uniqueness things. ah thanks You might have to partition those as well based on how you partition your store.
01:44:26.79
Chris Morrell
Yeah, sure.
01:44:26.93
Shawn McCool
And the the complexity that comes out of that, this is like this is why um I create these general patterns that continue to work across a wide variety of circumstances. This is why like i I don't generally rewrite my event store. This is why I don't generally, um ah like i why I want to model so my event streams are as simple as possible. This is why I don't use my event streams to populate the aggregate and then put a bunch of getter methods on the aggregate so other ah parts of the application can just read out of the aggregate. I don't do these things because then
01:44:59.51
Shawn McCool
the Like in my experience, I hit some kind of circumstance where I want to change things, and these things end up so coupled together. that my reads are coupled to my writes now and all of these things that I have gone through all this trouble to learn all of these design patterns to avoid. And now I did it again, I coupled it all together again. So I think that there is a balance and and you can probably find but a way to navigate this terrain ah that where you're creating value. um But i I just can't help but to think like,
01:45:32.14
Shawn McCool
It's safe, it's safer if I use these tools ah because I can see how I can get away with partitioning my data, which I will do like anytime, like I will partition my event store. Absolutely the second I get a chance to, ah the second I have a single reason to, I want to partition that so that I can horizontally scale the event store.
01:45:52.20
Shawn McCool
I can horizontally scale all of the projections. I want the the system to have a flat performance profile so that it doesn't just keep getting slower over time. And I want to be able to implement that into the system. And that's inherent to the kind of problems I'm looking to solve. I think you can do this. I think you can navigate it, but you're going to have to be really critical about what the downsides are of the patterns you're implementing and trying to to you know balance those.
01:46:18.93
Chris Morrell
Sure. Yeah. it's I haven't made a decision yet. you know I think that there's think both of the approaches seem perfectly viable. um And there's a lot of upside to sort of the the original ah the original concept of just like you know implementing some sort of reservation system that's that's like native to verbs.
01:46:42.45
Chris Morrell
um So I don't know, I've just been mulling it over, but I did, i I really enjoyed that part of the stream because i i I just hadn't come across that idea and it really does ah solve some real problems that I have bumped into many a time in like a really elegant way.
01:46:57.68
Shawn McCool
Sure, absolutely.
01:47:03.52
Chris Morrell
um If you kind of like hand wave around some of the implementation concerns.
01:47:09.18
Shawn McCool
Yeah, no, I think that there's there's a reason why very smart people who have a lot of experience in in this area are exploring this, right? I think there's like real value to be had here.
01:47:20.87
Shawn McCool
um And i I personally have some friends who are like just infatuated with the idea.
01:47:21.08
Chris Morrell
Yeah.
01:47:27.58
Shawn McCool
And you know maybe I just have ah i have a lot to learn about it before I get too excited about it. I'm i'm struggling to see how it solves my problems because I i don't seem to be having those problems. um but This is just ah maybe a limitation of my experience of the of the the things I'm specifically doing. And maybe if I was having different problems to solve, this would be much more exciting for me. Either way, I trust the people who were working on it. like ah they They seem like really intelligent people. And i I'm excited to see where it goes.
01:48:01.76
Chris Morrell
Awesome. All right. Well, is there anything, uh, anything else that you wanted to to touch on before we start to close up?
01:48:11.32
Shawn McCool
I don't know. I think i think that I'm good. i I wouldn't mind having a couple people maybe show up for for my Twitch stream every Sunday ah if some of your viewers are listening. That would be cool.
01:48:21.27
Chris Morrell
Yeah, absolutely.
01:48:21.43
Shawn McCool
It's like, yeah, it's Twitch TV slash Sean McCool, and that's it. Just every Sunday I'm trying to do a stream, and it's highly experimental. I don't know where I'm going to go each each episode, but you can check out my YouTube channel under the same name, right and it has old streams.
01:48:35.21
Shawn McCool
so I don't know, give that a shot. I'd really, really prefer, though, to have people come on and chat during the stream. That would be like my my preference. Ideally, it's not like me ramb rambling into the void for an hour and a half, right? I'd love to have more people come in and talk to me about their like their their challenges learning about it, or exciting new ideas they have, or just disagreeing with me on my approach, right? That'd be very cool, too.
01:48:59.30
Chris Morrell
Yeah, definitely. I mean, that was, that was going to be my next question is, uh, is there anything that you want to promote or, and how do people find you? You touched on it, but is there anything else that you've got going on that, uh, I dunno, you're excited about, you want people to check out?
01:49:14.80
Shawn McCool
Uh, not really, not really. I got this, the stream and having the conversations is really kind of like the, the thing I have the energy to do after my, after my workday. And so that's where I'm putting all my, all my effort, I guess.
01:49:24.60
Chris Morrell
Sure.
01:49:27.38
Chris Morrell
OK, so that's that's consistently on Sundays.
01:49:31.22
Shawn McCool
Yeah, that's, that's what I'm doing.
01:49:31.69
Chris Morrell
Is it.
01:49:32.22
Shawn McCool
It's Sunday, Sunday evening, my time. So it's, it's a 1600 UTC plus one. So however that breaks down to you. So it's six, it's four o'clock in the afternoon, Amsterdam time.
01:49:41.88
Chris Morrell
OK, OK, yeah, and that so that ends up being, you know, mid morning for us east coasters and.
01:49:49.88
Shawn McCool
I'm trying my best to to get to the Americas. I really am.
01:49:54.19
Chris Morrell
Yeah, it's hard. I mean, it's it's hard to find a time that works for everybody. But i that covers a pretty good span.
01:50:01.37
Shawn McCool
Yeah.
01:50:02.00
Chris Morrell
Yeah, I definitely encourage everyone to check it out. It's it's been really fun to watch. ah ah you know i've only I've only got to to watch one live and and the tail end of another, but like you you have those recorded um so you can go back and watch them.
01:50:17.15
Shawn McCool
yeah
01:50:21.43
Chris Morrell
it's a It's great to hop on there. Even if you don't know much about event sourcing, I'm quite certain that Sean is is happy to have you on to just like ask ah ask those introductory questions because like a lot of really interesting things can come out of that too. So everyone out there who's like,
01:50:40.11
Chris Morrell
You know, a little bit interested in event sourcing, a little bit interested in verbs, like watched ah Daniel's talk at Laricon is like, damn, that was cool, but I don't know how to get started. Like, uh, check Sean's, uh, Sean's Twitch stream out. And also, I mean, I know that sorcery is, is, uh, has been around for a while, but.
01:51:00.88
Chris Morrell
Um, you know, really anyone who wants to get into event sourcing, it's still an incredible free resource, um, to, to learn about the the principles. And I love how you sort of like build things up from the ground up just with like plain old PHP. Um, it's not, it's not.
01:51:21.23
Chris Morrell
ah You don't have to learn about a specific event sourcing framework or methodology. It's just like, let's just step through these concepts at the in the simplest way possible. And I think it's a great way great way to learn. um And then I know that you're still on Twitter. You're also on Blue Sky. ah Is it you're at traumacool.com? Or what's your what's your handle?
01:51:43.35
Shawn McCool
Yeah, it's Sean, S H A W N M C dot cool. That's my blue sky.
01:51:47.18
Chris Morrell
I love it.
01:51:47.92
Shawn McCool
Uh, and that's really where I'm preferring to do everything. Uh, that's also my website, by the way, Sean, MC dot cool. Uh, you can get ahold of me there if you want to chat about anything. I'm really super interested in having conversations with people, especially if I can get you on webcam on stream, that would be the the best possible situation.
01:52:03.81
Shawn McCool
But I'll talk to you about anything if you can, if you'll fire up your webcam. So let's do that.
01:52:08.94
Chris Morrell
Awesome. All right, Sean, this has been so much fun. Thank you for, uh, thank you for, thank you for hanging out.
01:52:13.66
Shawn McCool
Yeah, thanks for having me.
01:52:15.37
Chris Morrell
All right.