ebook img

Event Sourcing in Python - Event-oriented Analysis and Design with Applications PDF

348 Pages·2020·2.997 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Event Sourcing in Python - Event-oriented Analysis and Design with Applications

A Pattern Language for Event Sourcing in Python Event-oriented analysis and design with applications. By John Bywater Copyright © 2020 John Bywater All rights reserved. No part of this book may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying, recording, or by any information storage and retrieval system, without permission in writing from the publisher. Contents Preface INTRODUCTION Prologue Whitehead’s Scheme Domains and Domain Models Overview of the Patterns PART 1 DOMAIN MODEL Chapter 1 Domain Event Chapter 2 Aggregate Chapter 3 Mapper Chapter 4 Recorder Chapter 5 Event Store Intermission 1 Notifications PART 2 APPLICATION Chapter 6 Notification Log Chapter 7 Snapshot Chapter 8 Repository Chapter 9 Application Chapter 10 Remote Log Intermission 2 Tracking PART 3 SYSTEM Chapter 11 Log Reader Chapter 12 Policy Chapter 13 Process Chapter 14 System Chapter 15 Runner APPLICATIONS Bank Accounts Cargo Shipping Epilogue Index Preface I began writing the main parts of this book (in Parts 1-3) after giving a talk to the Domain-Driven Design London meetup group in November 2019 about event sourced building blocks for Domain-Driven Design, based on my experience of event sourcing in Python. During this talk, I presented a set of patterns for event-sourced Domain-Driven Design based on the design and capabilities of the Python eventsourcing library. I identified fifteen main patterns and the dependencies of each pattern on the others. The directed graph of patterns revealed a linear ordering that would allow the patterns to be discussed one-by-one without the need to refer to patterns which had not already been introduced. The main chapters of this book follow the structure of that talk, with each of the main chapters describing one of the patterns. These fifteen patterns fell naturally into three groups of five. These three groups were taken as the three main parts of the talk, and have become the main parts of this book. These chapters present the material with more care and with more detail than I was able to provide in the talk. A map showing the graph of dependencies and the linear ordering is included in the final introductory chapter (Overview of the Patterns). The first two chapters of the book (Prologue, and Whitehead’s Scheme) were written following some earlier considerations about the general applicability of event sourcing. The material for these two chapters was developed during 2018 and 2019, and was gradually distilled and refined whilst preparing for presentations given at software conferences in 2018 and 2019. In the Prologue, I discuss Christopher Alexander’s pattern language scheme and its relationship to the modern process philosophy of Alfred North Whitehead. I make a respectful but slightly critical appraisal of how pattern language was taken up in software development, identifying the conceptual distance of classical object-oriented analysis and design from modern process philosophy, and the apparent overlooking of the event-oriented character of Christopher Alexander’s scheme. This conceptual gap left room for the unanticipated turn to event-oriented analysis and design, as expressed by event sourcing, event storming, and event modelling. I argue that the event-oriented approach is generally applicable, on the grounds that Whitehead’s scheme is generally applicable. This argument goes against classical object-oriented analysis and design which views the world as built up of instances of substance-quality categories with events having a marginal status, and of the early view of event sourcing that it is only applicable in limited circumstances. I had initially accepted those views, and was merely seeking how to identify the limits of an event-oriented approach, so that I would be able to tell when event sourcing is not appropriate in any given domain. The surprising result of my search was: to discover Whitehead’s scheme; to realise that Alexander’s scheme was a creative application of Whitehead’s scheme; that there are no domains that are not fundamentally comprised of events; and that the limits of the applicability of event sourcing is determined by the skills of the software developers rather than the nature of the domain they are desiring to support. In order to provide a logical and coherent conceptual foundation on which to construct a general event-oriented analysis and design approach for software development, a general introduction to modern process philosophy is provided as a second introductory chapter. An introduction to the notions ‘domain’, ‘domain model’, and ‘domain event’ is presented in the third introductory chapter (Domains and Domain Models). The notions are explained in basic terms, and put on an event- oriented foundation by refering to Whitehead’s scheme. This material has been separated from the patterns in the main parts of the book, in order to keep the patterns as concise as possible. Connections are made with person-centred psychology, which is described in more detail in the final chapter of the book (Epilogue). Acknowledgements I am very grateful to Kacper Gunia and the other organisers of the DDD London meetup for inviting me to give the talk about event sourcing in Python. I was greatly encouraged by Kacper’s generous remark, “You’ve come up with a particularly nice narrative and way of structuring the content.” I am similarly grateful for the support of the organisers of the software architecture and Python conferences at which I have spoken about these topics. I would like to express deep gratitude to Robert Smallshire and Mathias Verraes for involving me in the DDD EU conference in 2019, which gave me an opportunity to collect my thoughts about “events in software, process and reality” into a moderately communicable form. I am especially grateful to Michael Mehaffy, Rebecca Wirfs-Brock, Eric Evans, Ward Cunningham, Jim Coplien, Vaughn Vernon, Grady Booch, and David Heath for detailed discussions during 2019 and 2020, for their interest in these topics, and for the encouragement these discussion have given me to write this book. I have also greatly appreciated discussions I have been having with various academic philosophers, in particular Prof James R Williams and Dr Peter Sjöstedt-H. Their guidance and conversation about the work of Alfred North Whitehead helped to reassure me in my understanding of Whitehead’s work. I would also like to thank the many companies that have asked me to work with them professionally over the past five years to create event-sourced applications and systems. Without these practical encounters, the Python eventsourcing library would likely not have come into existence, and my sustained interest in these topic would not have been possible. Last but not least, I would also like to thank the users and supporters of the Python eventsourcing library for their friendliness, expressions of gratitude, contributions, good will, pleasantness, and encouragement. INTRODUCTION

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.