wroc_love.rb 2019

Events Events Events

wroc_love.rb 2019

00:00:14.620 Hello, I’m a little bit nervous, and this is where I need to check this clicker. I think it all works and I want to say it's a really complicated conference because I was at three different after-parties over the last three days. It was hard, but I hope we made it, and I'm happy that today's the last party.
00:00:22.720 The city is really nice. When I walked around, I found this place, and I can say it looks like the previous two parties. Usually, I manage the hashtags on Twitter, and I found out that dogs can drink beer, so hello Roscoe.
00:01:00.370 It's my first time in Poland, and before I came here, I only knew two things about Poland. The first one is that there are a lot of great ideas and engineers here. I work a lot with drive systems and ROM, and I often read blog posts from our community.
00:01:08.830 The second thing I knew was that Poland is a place with some nice games. I really love these games. Wow, awesome!
00:01:41.079 Now, as the first and most important part, let's talk about food. In Russia, we have a dish called pelmeni, which I think is awesome. I tried vareniki yesterday, yes, it was yesterday. It was funny because usually in Russia, we have very small dumplings, but yesterday they were quite different.
00:01:54.520 I found the best implementation of state machines thanks to this conference. It looks like this: just five lines of code, and I have everything. Also, I found out that it is popular here. I checked and found that we have six talks about event sourcing or mentions of event sourcing. Unfortunately, memes are not very popular because I found only three dog-themed talks.
00:03:02.750 I'm happy to be here, and thank you everyone. My name is Anton, and I'm from Moscow. I'm a Russian developer. You can usually meet me when everyone says 'Konami.'
00:03:09.319 I work at Hippo, an American startup that focuses on open-source software and economic development. I try to create products and also work as a technical consultant. I love stickers; you can check my laptop, and you'll see that I really love stickers. If you want to talk with me, we can chat about different topics, like coffee.
00:03:30.229 I'm really happy to see that it's obvious. This is the first conference where I can drink a lot of coffee because the coffee is great here. I also found a lot of craft beer, which makes me happy.
00:03:59.629 And I have a Nintendo Switch if anyone wants to play. When I return to Moscow, I can also share my love for drawing and creating images for my presentations. All the images you will see in this presentation were drawn by me.
00:04:13.549 When I was preparing for this presentation, I tried to create a story. I expected that I would appear like an amazing storyteller, someone who could craft a compelling narrative. However, the reality turned out to be different. Thankfully, I received help from my good friend, Jia Jie, who has a knack for asking insightful questions.
00:04:31.759 So today, I am going to talk about events—events in school, in our daily lives, and in programming. I drew parallels between events and state machines, where we need to catch these events and do something with them.
00:04:44.750 I love this example of a digital commit. In software development, each commit is like an event in our application.
00:05:52.250 In this way, events help us understand what happened before and what we will do with it. If you've ever deleted or updated data, you know how important it is to track changes and maintain the integrity of your information.
00:06:10.010 I think you understand my concern, as programming usually involves increasing the current state of the application. In our web applications, our actions lead to events that signal that something has occurred, and our database reflects the current state. However, sometimes we grapple with questions about what will happen based on those events.
00:07:06.569 Generally, we can store our events in a persistence layer, which can be anything from Oracle, MongoDB, Kafka, or even Redis. We must adhere to a few rules: the first rule is that an event must have happened, and the second rule is that events are immutable. This means you cannot delete or update an event. You can only create new events to reflect changes in your application's state.
00:08:05.439 When you receive data, it’s important to validate it beforehand. Similarly, when we have systems that are guaranteed to be immutable, we need to consider data evolution. Imagine you run a startup and initially decide to store users' first names. Later, if it mistakenly changes to full names, you could break your application. You can combat this by using optional fields or binary data structures to maintain multiple versions of your stored data.
00:09:30.220 When we’re trying to obtain the current state from our list of events, we can calculate it using projections, which can be represented as a function that takes three parts: a context function, our events, and the initial state.
00:10:02.400 This design ensures that we always derive the same state from the same initial conditions. A common challenge arises when calculating the current state; we may need to compile it constantly over time, resulting in slower processing. For applications running for extensive periods, this can become an unbearable barrier.
00:10:31.899 To improve state calculations, we can use streams to simplify relationships between events. For example, if we consider a bus system, we can represent events related to each bus in separate streams. By doing so, we can reduce the complexity of our data processing.
00:11:05.010 Another approach is to use snapshots for our current data state. If we have our events and determine our application state, we can store this state for quick access when needed. This method may require stable caching techniques for efficient retrieval.
00:12:45.570 In the real world, event sourcing has utility in various applications, particularly in e-commerce systems where order handling can be complex. Synchronization and proper version control become crucial when working with events. Tracking user interactions, for instance, can also benefit from event sourcing—particularly in systems that rely heavily on historical data.
00:14:08.489 In contrast, event-driven systems often handle event management quite differently from traditional event sourcing. Although both systems utilize events, event sourcing records every event in its original form while event-driven architecture reacts to the current state of the system.
00:14:35.730 A significant advantage of using event sourcing is the ability to restore the application state easily. If issues arise, we can retrieve the current state, time-traveling back into data history to see what transpired in our system. This feature lends itself to enhanced debugging and overall security.
00:15:06.460 However, the trade-offs are worth considering. Event sourcing can make developers' lives more complex due to new patterns they must adapt to—sometimes it isn’t a one-size-fits-all solution. This method is accompanied by its own challenges like ensuring data integrity and keeping track of version compatibility.
00:15:44.020 As developers adapt to this architectural style, it’s vital to employ suitable tools to abstract some complexities. Using event sourcing presents its struggles, but those challenges may be outmatched by its advantages.
00:16:10.570 Understanding the trade-offs between different architectures can lessen development costs. For instance, embracing the principles of Event Sourcing early can save time and assets down the line, especially considering how it empowers teams to create modular systems.
00:16:50.150 In conclusion, while Event Sourcing may not be the perfect solution for every situation, it can be incredibly useful when correctly implemented. Fostering understanding among your team about how data flows and evolves could lead to maintaining an efficient system.
00:20:00.000 Thank you for your attention, and I look forward to answering any questions you might have.
00:33:39.330 Hi there, thanks for my talk. I appreciate everyone here, and I'm grateful to have had the opportunity to share my thoughts on event sourcing and its implications. What's exciting about this approach is its potential for transformation.
00:34:00.240 And while I understand there are challenges ahead, I also believe that as we evolve our practices, we learn to leverage our technology in ways that will empower developers.
00:34:20.240 If we can open dialogues like this, we shed light on the perception around these strategies, paving the way for even better implementations down the road.