<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[TwoTonic Labs - Medium]]></title>
        <description><![CDATA[Helping teams design and build modern software that aligns with corporate strategy. We ensure that business and IT have a shared understanding of what they’re building and why so that the process is satisfying and the outcome is what the business wants and needs. - Medium]]></description>
        <link>https://medium.com/twotoniclabs?source=rss----8a70797fac7e---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>TwoTonic Labs - Medium</title>
            <link>https://medium.com/twotoniclabs?source=rss----8a70797fac7e---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 06:27:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/twotoniclabs" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[What do they mean by “One Database Per Microservice”?]]></title>
            <link>https://medium.com/twotoniclabs/what-do-they-mean-by-one-database-per-microservice-77d68ac86298?source=rss----8a70797fac7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/77d68ac86298</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[microservice-architecture]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Robert Reppel]]></dc:creator>
            <pubDate>Sun, 22 Nov 2020 16:57:08 GMT</pubDate>
            <atom:updated>2020-05-05T14:45:39.476Z</atom:updated>
            <content:encoded><![CDATA[<h4>Consider event sourcing. The pattern is viewed as very suitable for building microservices. One of its defining characteristics is the use of a giant, free-for-all globally accessible database where the data of every single microservice are available to all comers to use in any way they please (the event log). Why is that?</h4><p>“Should these processes share the same database?” is a perennial topic of discussion when developing services. One way to decide is to apply the same criteria we use to determine whether or not we want to introduce a global variable.</p><p>The problem with global variables: If Clara runs code which counts from 1 to 10 and Larry changes the counter variable to -8 while Clara’s code is executing, hilarity ensues.</p><p>The rules, established decades ago, are such:</p><p><strong><em>1. Don’t use global variables.</em></strong></p><p><strong><em>2. Global constants are OK (because they are side-effect free: Larry can’t change a constant).</em></strong></p><p><strong><em>3. When you use a global variable, be REALLY REALLY REALLY sure that it’s only ever going to be changed in the same whack of code, owned and maintained by Clara. Larry can read it to his heart’s content, but he MUST NOT change it.</em></strong></p><p>Rule 3 couldn’t be clearer. If there are bugs because it is being broken, that is an HR problem masquerading as a technical issue: They have consistently failed to hire infallible programmers. Over time, this failing has led to any number of awkward workarounds trying to minimize the resulting carnage (“microservices”, “software architecture”, “development managers”, “100% test coverage”, “code reviews”, “database permissions”, “event sourcing”, “Domain Driven Design”, etc., etc.).</p><blockquote>Sharing a database and using global variables are very nearly the same thing, except that global variables won’t survive tripping over the power cord.</blockquote><p>Let’s use those rules to break up a monolith. Consider an event storming of a system for user registration, password management and profile editing:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/844/1*l2OaEX16_Jsi6dy1GkK6Xw.png" /><figcaption>Commands and events are shown on a timeline from left to right as they happen when the user takes a series of actions in the UI. Diagram from <a href="https://getstorystream.com/">https://getstorystream.com/</a> .</figcaption></figure><p>A monolithic implementation of those requirements would be:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/338/1*bpV3NqsZnZpQaZQ2uNZIbg.png" /><figcaption>A monolith: One service with multiple responsibilities in the same unit of deployment.</figcaption></figure><p>As the system grows, maintaining user registration and handling user authentication becomes Clara’s job. Larry is in charge of profile management.</p><p>Clara relies on email never, ever being changed by Larry.</p><p><strong>Larry is not infallible:</strong></p><ul><li>Clara authenticates users by username (=email) and password.</li><li>Larry allows users to change their email when they edit their profile.</li><li>Barney (a user) logs in with barney@fakemail.com, then goes to “My Profile” and changes his email to mynewemail@fakermail.com.</li><li>Barney calls customer support because he cannot log in with his previous username (barney@fakemail.com) anymore. You could argue that Barney should have realized that his username changed when he modified his email. Given how tired Jane (a customer support person) is of arguing with Barney, you’re more than welcome to do that but she certainly won’t.</li></ul><p>Given the nature of requirements (they are written in stone until they change and multiply at the same time), the real fun begins when there is a request to support separate work, home and password retrieval emails. And every user can have multiple profiles because we are pivoting to that model. Which one of those profiles has the email used as the username and what query does Clara run to get it when she checks for valid logins?</p><h3><strong>How do we fix this?</strong></h3><blockquote>We need a design goal to optimize for. I know what you’re thinking. Forget it. You’re being a geek. Loose coupling, strong cohesion and single responsibility are bullshit. No-one understands that stuff.</blockquote><p>Because of Conway’s Law, the forces determining the actually implemented vs. the envisaged architecture of a system are only vaguely related to technical considerations or the skill of the developers. The architecture is for the most part determined by project managers who decide what meetings should be held when and who should be in them.</p><p>Project managers are fallible too. Even scrum masters are fallible.</p><p>It follows that we should be optimizing the code for requiring the least number of meetings with the least participants: Make it resilient to having the wrong people in the room at the wrong time.</p><p>Given the new set of requirements and the current monolithic architecture, here’s a list of meeting agendas and participants:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/677/1*FyVZ5ciU_YT2xkcbfI-jJw.png" /></figure><p>Let’s optimize the architecture for reducing the number of meetings and participants.</p><p><strong><em>The knack for getting global variables (… or microservice boundaries and databases) right is to look at what data a service needs in order to function and whether it owns them or not:</em></strong></p><ul><li>The microservice should be the one and only place which changes the data it owns. “Owning” means that the service is the source of truth for a given piece of data. For example, the “User Authentication” service would be the only place where passwords are changed.</li><li>If a microservice depends on data which it doesn’t own, it should have explicit control over whether or not it accepts an outside change. For example, Larry should be able to decide freely that users can edit their email, without risking to blow up user logins, regardless whether Clara can’t attend meetings because she is on vacation or not. (… and vice versa, for example if Clara ever decides to allow usernames which aren’t emails).</li></ul><p>With those criteria in mind, let’s make “microservices”:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*31ugl7XJ45H015p9Dha6-g.png" /></figure><ul><li>The User Authentication Service completely owns password changes. No-one else has any business knowing the value of the encryptedPassword field.</li><li>“User Profile Service” owns all updates to names, phone no. and the address.</li><li>The email address is “global”: Both services need to access it. Although “User Authentication” uses it as a username, it is owned by “User Profile”.</li><li>When Barney signs up as a new user, Clara publishes a “User Signed Up” event with a username property. If Larry wishes to subscribe to that to create a profile for new users with the email address in it he can do so. He would then implement the necessary context map and anti-corruption layer for username = email, with suitable validation that the username does indeed constitute a valid email address, in case Clara changes the username to be a phone number while Larry is out getting coffee.</li><li>If Jane gets too many support calls because users expect their login name to change if they update their email in the profile, Clara can subscribe to the “User Profile Update” event and change the username (=email) when that happens.</li></ul><p>Let’s evaluate this new architecture against our meeting schedule:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/679/1*VIeW2-QPZHKqvJVE1Pok-A.png" /></figure><p>Not bad.</p><p><strong><em>To answer the question at the beginning of the post: The reason why the event sourcing pattern works for loosely coupled microservices while at the same time relying on a globally shared database (the event log) is that communicating state via events makes it possible for a microservice to “opt in” to state changes in other microservices: It can choose whether to subscribe to the resulting events or not. Dealing with global variable style side effects is now a deliberate act instead of an accident-prone necessity.</em></strong></p><p><strong><em>The direct result is less project coordination overhead and less need for checks &amp; balances because services are more likely remain more loosely coupled and cohesive as requirements change and the system evolves.</em></strong></p><p><strong><em>It isn’t necessary to implement an event sourced system to get this benefit. As long as every service (including legacy systems) “talks about what changed” by publishing events whenever the data it owns have changed, event sourcing is a nice-to-have.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=77d68ac86298" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twotoniclabs/what-do-they-mean-by-one-database-per-microservice-77d68ac86298">What do they mean by “One Database Per Microservice”?</a> was originally published in <a href="https://medium.com/twotoniclabs">TwoTonic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bad-Day Software Engineering: Blundering Your Way to Success]]></title>
            <link>https://medium.com/twotoniclabs/bad-day-software-engineering-blundering-your-way-to-success-87f6670f5fda?source=rss----8a70797fac7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/87f6670f5fda</guid>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[enterprise-architecture]]></category>
            <dc:creator><![CDATA[Robert Reppel]]></dc:creator>
            <pubDate>Wed, 18 Sep 2019 21:06:08 GMT</pubDate>
            <atom:updated>2019-09-19T19:19:13.262Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vqFAnYnVOkSnMVsVdHeHw.jpeg" /></figure><blockquote>“It’s 2am before a major deadline. A must-do bug fix and a feature are still not done. We’re all very tired.”</blockquote><p><strong>An architectural “guide fence” is anything which helps to ensure that the most likely course of action overwhelmed developers and project decision makers under pressure are taking is the right thing to do.</strong></p><p>Software is used by people to achieve some end. It is part of a <a href="https://en.wikipedia.org/wiki/Sociotechnical_system">socio-technical</a> system.</p><blockquote>Delivering software and related infrastructure is in itself a socio-technical system. Guide fences would be attempts to deliberately shape this system in order to minimize the need for top-down governance and coordination. Individuals and teams can boldly own decisions: If in doubt, they know that they are furthering business goals and are making good technical choices by following the path of least resistance.</blockquote><p>When I think about architectural guide fences for teams/projects/products, I try to use a kind of benchmark scenario to work outward from (“crisis at 2am before a major release“). Ideal guide fences would ensure that the most obvious shortcuts suggesting themselves in high stress, limited time situations are likely to be the correct choice.</p><p>“Correct” in this context means:</p><ul><li>Gets the job done as and when needed</li><li>Does not increase or (… ideally / if-pigs-could-fly …) decreases technical debt</li></ul><p>The design goal of an architecture which takes guide fences into consideration is to make doing the “right” thing easy and doing the “wrong” thing hard.</p><p>For example: Using separate databases for subsystems which represent transactional consistency boundaries is an example of a “practices” guide fence which makes it harder to work with data which shouldn’t be accessed directly. As such, there is no technical reason why one should use a separate physical or logical database for every service. Barring infrastructure considerations (scalability?), it would be perfectly fine to just have (e.g.) all tables in the same database and database schema, as long as developers do not write code which uses them in side-effect-prone ways and leads to unnecessary coupling. In that sense, a “thou shalt use one DB per service” guide fence is a workaround until developers become infallible.</p><blockquote>A “thou shalt use one DB per service” guide fence is a workaround until developers become infallible.</blockquote><p>Other examples:</p><p><strong>Namespacing</strong>. Done in the ubiquitous language / semantics-oriented way Eric Evans describes it in the <a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215">Blue Book</a>, it provides guidance for where to put modifications and additions so that what changes together winds up in the same part of the code base and is part of the same unit of deployment. It thereby increases the likelihood that coupling and cohesion remain manageable as the system evolves.</p><p><strong>Bounded Contexts </strong>as an organizing principle for system boundaries because they work with our natural <a href="https://medium.com/twotoniclabs/hands-on-designing-better-microservices-in-plain-english-2fb9a41850bd?source=friends_link&amp;sk=9fa941e29de48a900d2340f5ee4d32b4">ability to recognize what doesn’t fit in</a>.</p><p><strong>Intellisense</strong> because entering the “right” thing is more likely.</p><p>A <strong>linter</strong> would be an example of a “warning” guide fence.</p><p>At this point, I haven’t tried to use the “guide fencing” concept in enough project work to have firm opinions about it, but I look forward to experimenting more.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87f6670f5fda" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twotoniclabs/bad-day-software-engineering-blundering-your-way-to-success-87f6670f5fda">Bad-Day Software Engineering: Blundering Your Way to Success</a> was originally published in <a href="https://medium.com/twotoniclabs">TwoTonic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Successful Digital Transformations: Do First Things, First!]]></title>
            <link>https://medium.com/twotoniclabs/successful-digital-transformations-do-first-things-first-8d6106812cc6?source=rss----8a70797fac7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/8d6106812cc6</guid>
            <category><![CDATA[legacy-code]]></category>
            <category><![CDATA[design-thinking]]></category>
            <category><![CDATA[digital-transformation]]></category>
            <category><![CDATA[leadership]]></category>
            <category><![CDATA[strategic-planning]]></category>
            <dc:creator><![CDATA[Robert Zalaudek]]></dc:creator>
            <pubDate>Fri, 09 Aug 2019 18:29:01 GMT</pubDate>
            <atom:updated>2019-09-20T19:59:25.554Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*Xk_hqOb526mEfsKAIkWMLA.jpeg" /></figure><p>Not a day goes by without a myriad of posts on digital transformation. While most have valid points to make, the challenge is that they mostly talk about coming trends or new technologies that organizations should adopt. What Few want to talk about is the fact that you can’t simply bolt on new tools and technologies and get the maximum benefit from them.</p><blockquote>…you can’t simply bolt on new tools and technologies and get the maximum benefit from them.</blockquote><p>A recent, refreshing piece by <a href="https://www2.deloitte.com/insights/us/en/focus/tech-trends/2019/macro-technology-trends-forces-at-work.html">Deloitte</a>, pointed out that there are three macro trends that digital transformation initiatives need to pay attention to while dreaming about implementing some of the others like blockchain, AR/VR and artificial intelligence — to name a few.</p><p>This post reviews those three areas, adds my own perspective as well as a key perspective shift that some organizations are embracing to bring about effective digital and organizational transformation.</p><p>1) The Business Of Technology</p><p>The trend that the post talks about is the “business of technology” Essentially, technology as an enabler of business and everyone in a modern company being a technologist e.g. everyone leveraging the tools that best execute on the strategy of the business.</p><p>In order for this to happen, everyone in the organization must come to see themselves in this new light. The way to make this happen is to involve teams in co-creating the strategy that they will have to implement.</p><blockquote><em>involve teams in co-creating the strategy that they will have to implement.</em></blockquote><p>2) Core Modernization</p><p>In order to get from where the business is now to where it wants to go, it needs to understand its current capabilities, potentially use these as way to clarify where it wants to go and map out a plan to get there. Once the organization understands where it is and where it wants to go, it can decide which modernization strategy it should employ. Deloitte labels them: replatform, revitalize, remediate, replace, and retrench.</p><blockquote><em>Once the organization understands where it is and where it wants to go, it can decide which modernization strategy it should employ.</em></blockquote><p>3) Cyber</p><p>As the complexity and connectedness of modern organizations continues to grow the threat of cyber attack grows with it. As such, cyber is a key aspect of transformation, in Deloitte’s view.</p><p>If these three areas serve as the basis for further modernization then I would suggest that they be undertaken in a specific order.</p><blockquote><em>If these three areas serve as the basis for further modernization then I would suggest that they be undertaken in a specific order.</em></blockquote><p>Change Your Thinking, Change Your Outcome</p><p>People change their perception of themselves when they begin to experience the organization differently. Therefore, from our perspective, core modernization must come first. As the organization begins to change how it does things and the individuals involved must think and act differently, then their view of themselves and the organization changes. Based on the changes that are taking place, they will see how to change the organization for the better and also the need to protect the organization from external attack.</p><blockquote><em>…core modernization must come first.</em></blockquote><p>In order to bring about meaningful, long term change, teams must be involved in the change and they must talk about and reason about processes and systems in fundamentally different ways. One approach that we’ve used to do this very effectively is <a href="https://getstorystream.com/blog/eventstorming-overview/">Event Storming.</a></p><blockquote><em>…to bring about meaningful, long term change, teams must be involved in the change and they must talk about and reason about processes and systems in fundamentally different ways.</em></blockquote><p>The Bottom Line</p><p>Continually adding to the legacy code that was already in place is what has made core modernization so challenging. In most cases, simply adding new capabilities either won’t work at all or will result in a fraction of the benefits that could be had with a modern core. It is essential to understand what capabilities you currently have in order to determine how best to proceed based on where the organization wants to go and how it plans to get there. Having done this well, implementing modern technologies becomes quicker, easier and potentially as game-changing as many predict — but core modernization must come first.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8d6106812cc6" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twotoniclabs/successful-digital-transformations-do-first-things-first-8d6106812cc6">Successful Digital Transformations: Do First Things, First!</a> was originally published in <a href="https://medium.com/twotoniclabs">TwoTonic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Designing Future-Proof Microservices: Three Steps You Don’t Want To Miss]]></title>
            <link>https://medium.com/twotoniclabs/hands-on-designing-better-microservices-in-plain-english-2fb9a41850bd?source=rss----8a70797fac7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/2fb9a41850bd</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[microservices]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <dc:creator><![CDATA[Robert Reppel]]></dc:creator>
            <pubDate>Wed, 24 Jul 2019 22:11:32 GMT</pubDate>
            <atom:updated>2019-07-25T18:27:52.341Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Nail coupling &amp; cohesion and get service boundaries right with Bounded Contexts and Ubiquitous Language.</em></p><p>We have a knack to spot what doesn’t fit in, evolved over a million years:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*acIcTQKyDjPwTeCTef_ozA.png" /></figure><p><strong>What if we could use that to build better software?</strong></p><p>In fact, we can. It turns out that we can use plain English and our innate “What’s wrong with this picture?” ability to get nice, clean system boundaries and APIs.</p><p><strong>OK … so what makes a system boundary “nice and clean”?</strong></p><p>The software based systems we usually work with are state machines: Like a traffic light, the result of <em>changeLight()</em> depends on whether the previous state was “Red”, “Amber” or “Green”.</p><p>The current state depends on what happened in the past (stored in things like “databases” and/or “event logs”).</p><p>The future state of any such machine <strong>ALWAYS</strong> depends on:</p><ul><li>Its current state</li><li>The state change instruction (“command”) that was received.</li><li>The parameters of the command.</li></ul><p><strong>ALWAYS</strong>, that is, <strong>unless</strong> whacks of code other than the state change instructions (“commands”) belonging to it modify the state machine’s state. Also known as a side effect. Side effects cause bugs. They can cause major regression testing effort and slow down release cycles. They even cause bureaucracy. (“That outage nearly killed us. From here on in, no-one does a deployment without sign-off.”)</p><blockquote>Services with “nice and clean” system boundaries are cohesive. Things which belong together are located in close vicinity in the code, share a single purpose and aren’t mixed together with concepts and functionality which don’t belong there.</blockquote><p>They have low coupling in the sense that the service has all the information it needs to make decisions in its own data store and from command parameters. It won’t make incorrect decisions or be brought down because it relies on calling another external service which may be unavailable or malfunctioning.</p><p>Let’s work through an example how we can architect easier to maintain and more side-effect free software by using business domain events and two concepts from Domain Driven Design: “Ubiquitous Language” and “Bounded Contexts”:</p><h3>Step 1 — Communicate &amp; Understand: Event Storming</h3><p><strong><em>Event storming is a rather simple idea: Get people in a room and have them describe the various workflows through a system in terms of “If this had been live for a year, what business events (“Order Placed”, “Payment Processed”, “Item Shipped”, …) would have happened and in what order?</em></strong></p><p>In this example we’ll use a bicycle sharing app which was reverse-engineered from an actual real-world system in a <a href="https://getstorystream.com/blog/esl-bikeshare-example/">previous blog post</a>. Event storming works equally well to share and understand requirements for new systems and for exploring existing legacy code.</p><figure><a href="https://getstorystream.com/images/medium/post1/bikesharingexample-5981x687px.png"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vAH8YlrW7ri1v3jVw6rIIQ.png" /></a><figcaption>Timeline of events for the main Workflow (“Happy Path”) of the bicycle sharing app.</figcaption></figure><p>Traditionally, event storming is done with Post-It notes on a wall. We are using <a href="https://getstorystream.com/">StoryStream</a> and its text-based “Event Storming Language” (ESL) instead. StoryStream is currently in early beta. Feel free to check it out.</p><p>Event storming is a powerful tool because it can cut out technical jargon and focus participants on business outcomes, described in plain English, suitable for modeling services and planning technical implementations.</p><h3>Step 2 — Service Boundaries: Group what belongs together</h3><p>Forgetting all technology considerations, let’s figure out the flowers and where the sabretooths lurk, by gut feeling: Look a the domain events, commands, etc. and toss them into buckets. This can be done with <a href="https://github.com/robertreppel/kubel">Kubel</a>, an experimental Open Source tool for exploring Bounded Contexts.</p><p>Copy &amp; paste the following into <a href="https://robertreppel.github.io/kubel/">https://robertreppel.github.io/kubel/</a> :</p><pre>/// Bike Sharing</pre><pre>/// Locations</pre><pre>Set Up Bike Sharing Location-&gt; : locationId, lat, long, name<br>Location Added<br>Locations* locationId, lat, long, name<br>Add Bike To Location-&gt; bikeId, locationId<br>Bike Added : bikeId, locationId<br>// &quot;Bike Added&quot; could happen many times, depending on how many bikes are kept at this location.<br>Location* : list of bikes at location</pre><pre>/// Register User</pre><pre>Register-&gt; email<br>Registration Started : userId, email<br>Pending Registrations*<br>Confirm Registration-&gt; confirmationCode<br>Registration Confirmed : userId<br>Confirmed Registrations*<br>Set Password-&gt; userId, password<br>Password Updated : passwordHash</pre><pre>Add Payment Method-&gt;<br>Payment Method Added : creditCardToken, last4Digits<br>My Profile* : userId, email, creditCardToken, last4Digits</pre><pre>Charge Deposit-&gt;<br>Payment Processed<br>Deposit Received<br>// Deposit received only occurs if payment processing succeeded.The &quot;Charge Deposit&quot; command may be (e.g.) issued by a process controller &quot;microservice&quot; which issues it as a result of having received &quot;Registration Confirmed&quot; and &quot;Payment Method Added&quot; events.</pre><pre>/// Ride</pre><pre>Unlock Bike-&gt; locationId, bikeId<br>Bike Unlocked : bikeId<br>Ride Started : rideId, bikeId<br>Rides In Progress* :<br>Bike Removed : locationId, bikeId<br>Lock Bike-&gt; bikeId, bikeLocationLat, bikeLocationLong<br>Bike Locked<br>Bike Returned<br>// Only mark bike as &quot;returned&quot; if it&#39;s within 10 meters of a location.<br>Bike Added: bikeId, locationId</pre><pre>/// User deletes account<br>Rides in Progress* : userId, bikeId, startLocationId, startTime<br>// Registration cannot be deleted if a user is currently on a ride<br>Delete Registration-&gt; userId<br>Deposit Refunded : userId, amount, date<br>Registration Deleted</pre><pre>/// Remove bike sharing location<br>Remove Location-&gt; locationId=123423<br>Bike Removed : locationId=123423, bikeId<br>Bike Added : locationId=123456, bikeId<br>Location Removed : locationId<br>// &quot;Bike Removed&quot; for each bike at the location which is being removed (123423), followed by &quot;Bike Added&quot; for to another location, e.g. 123456. Maybe one location (e.g. 123456) could be the depot or maintenance location?</pre><p>Hitting “Generate Vocabulary” turns the text input into draggable vocabulary items:</p><figure><a href="https://getstorystream.com/images/medium/post1/kubel-vocabulary-bikeshare.png"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hrTs4VNV6Mna1ruwkhk8MQ.png" /></a></figure><p>The vocabulary can be dragged into groups which represent different <a href="https://www.martinfowler.com/bliki/BoundedContext.html">Bounded Contexts</a>. Each such group is a candidate for implementation as a separate service. Give it a try. When we did it, we wound up with this:</p><figure><a href="https://getstorystream.com/images/medium/post1/kubel-boundedcontexts-bikesharing.png"><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O8N4vCy26cuB1_ivhLDCag.png" /></a></figure><p>We have five potential services:</p><ul><li>User Authentication/Authorization</li><li>Rides</li><li>Locations</li><li>Payment Processing</li><li>Deposits</li></ul><h3>Step 3 — Assessing the Design: Monkey Wrenching</h3><p><strong><em>We have candidate services, but how can we know whether they have the right microservice boundaries? By switching them off.</em></strong></p><p><a href="https://en.wikipedia.org/wiki/Chaos_engineering">Chaos engineering</a> is usually applied to test the resilience of live IT systems, but the trick is also useful when assessing the business impact of software architecture decisions early on during design. Do a thought experiment …</p><p><strong>Turn the Location service off:</strong></p><ul><li>People can still sign up, make payments and deposits and check out bikes.</li><li>The number of available bikes shown at locations may be incorrect, leading to users being misled about availability.</li><li>Bike inventory management for support staff is no longer available.</li></ul><p><strong>Turn Payment Processing off:</strong></p><ul><li>It’s still possible to start registering for the bike share service and to log in, but checking out bikes doesn’t work for new users because no damage deposits can be be made.</li><li>If we design payment processing so that it processes queued payment requests later after the outage is resolved, it may still be possible for existing users to check out rides in spite of the service being down. The business risk is that some payment requests will fail, leading to free rides and revenue loss. This may or may not be acceptable.</li><li>Users can still see locations and the numbers of bikes available.</li></ul><p>Etc …</p><p>Services being unavailable affects the end user experience. “Monkey Wrenching” at design time makes the impact of outages explicit so that the necessary trade-offs can be made by business stakeholders.</p><p>Some impacts are acceptable and can be handled by (e.g.) customer support. Others (for example the batch payment processing capability above) require technical mitigation and the resourcing and planning that goes with it.</p><blockquote>A good architecture gracefully decomposes as services fail. What constitutes an acceptable level of “gracefulness” is a business decision, not a technical one.</blockquote><h3>Conclusion</h3><p><strong><em>We have seen how our natural ability to know what belongs together can be used to establish service boundaries which make for loosely coupled, cohesive and resilient systems.</em></strong></p><p>The technique is based on two Domain Driven Design concepts: “Ubiquitous Language” and “Bounded Contexts”. We have used this approach for establishing system boundaries in real-world projects in recent years and it has worked well.</p><blockquote>The advantage of using linguistic rather than technical criteria to determine system boundaries is that it makes for natural, intuitive “guide fences” when determining where code should live. (“Wait … what’s a variable called creditCard doing in the Locations service…?”).</blockquote><p>The technique is useful for both new systems and when “reverse-eventstorming” legacy code to establish refactoring directions.</p><p><strong><em>Next (… in future posts): Now that we know what services we need, we explore how these services communicate with each other and the “outside world” and how we handle transactions. The end goal is to have a design blueprint with sufficient detail for guiding implementation and </em></strong><a href="https://medium.com/twotoniclabs/why-it-happens-event-driven-project-management-6229698c6916"><strong><em>project planning</em></strong></a><strong><em>.</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2fb9a41850bd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twotoniclabs/hands-on-designing-better-microservices-in-plain-english-2fb9a41850bd">Designing Future-Proof Microservices: Three Steps You Don’t Want To Miss</a> was originally published in <a href="https://medium.com/twotoniclabs">TwoTonic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why it happens: Event-Driven Project Management]]></title>
            <link>https://medium.com/twotoniclabs/why-it-happens-event-driven-project-management-6229698c6916?source=rss----8a70797fac7e---4</link>
            <guid isPermaLink="false">https://medium.com/p/6229698c6916</guid>
            <category><![CDATA[agile]]></category>
            <category><![CDATA[event-sourcing]]></category>
            <category><![CDATA[project-management]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[eventstorming]]></category>
            <dc:creator><![CDATA[Robert Reppel]]></dc:creator>
            <pubDate>Thu, 21 Feb 2019 19:19:15 GMT</pubDate>
            <atom:updated>2019-02-27T01:17:33.688Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-MLUA7SwjulLqHyAcIufAg.png" /><figcaption>Food Delivery Service: A timeline of events from creating menus to placing orders.</figcaption></figure><p><strong>Event Storming is finally getting the mainstream love it deserves: The sole “Adopt” recommendation in the current </strong><a href="https://www.thoughtworks.com/radar/techniques/event-storming"><strong>(Feb. 2019) ThoughtWorks Radar</strong></a><strong>, in any category. After we adopted the technique we found an unexpected bonus. It greatly simplifies project coordination and cuts down wasted effort. That’s because we always know WHY we’re doing something.</strong></p><blockquote>… today’s one-dimensional focus on <em>struggle</em>, rather than <em>meaningfulness</em>, explains why many people spend <a href="https://medium.com/the-understanding-project/why-you-dont-need-to-read-those-productivity-guides-347fe02cc196">too much time on optimizing</a> their workflow, and not enough on <a href="https://medium.com/the-polymath-project/ricardo-semler-on-the-difficulty-of-presence-confrontation-with-death-and-what-success-really-59bbd2670734">questioning</a> if they’re working on the right problems. (<a href="https://medium.com/personal-growth/there-are-two-ways-to-be-busy-one-is-ruining-your-life-a2a9a7b0ed99">https://medium.com/personal-growth/there-are-two-ways-to-be-busy-one-is-ruining-your-life-a2a9a7b0ed99</a>)</blockquote><p>For those who don’t know, <a href="https://getstorystream.com/blog/eventstorming-overview/">Event Storming</a> is a way of very quickly understanding requirements by getting everybody in the same room and making them describe systems and processes in terms of the business events which need to occur, in the order in which they need to happen.</p><p>Event storming is the brain child of Alberto Brandolini. It’s brilliant because of the conversations which happen as people put events (… and commands, documents, business rules, …) on a wall full of sticky notes.</p><p>It can cut weeks of use case analysis to a day’s work because it gets everybody on the same page by shaping shared objectives (“this needs to happen here”) and business-friendly/non-tech language everybody understands.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*E81W5N8CcLDtHYCvjG90zA.png" /><figcaption>Commands: Actions users take.</figcaption></figure><p>We have used event storming as a requirements- and product definition tool for all our projects in the last three years and learned a lot during that time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/287/1*TB5HE4wBAzCtJ0jOBU4udg.png" /><figcaption>Events: What happened as a result of actions being taken.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/242/1*-RAsjvrSlnpBo8GGecA5LA.png" /><figcaption>Documents (a.k.a. read models) are information users need (e.g. displayed on screen) so they can make decisions about what action to take next.</figcaption></figure><h3>Event Driven Project Management</h3><p>One of the things we found ourselves doing is “Event Driven Project Management”.</p><p>We start with rotating the timeline of events and documents by 90 degrees and put them on a Kanban board. We like to use Trello, but anything will do:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*ZKt3XNW7iSuASR43sdTI4w.png" /><figcaption>“Project Plan” for the food delivery service</figcaption></figure><p>Each of the events (Menu Created, Order Created, etc.) and documents (“Menu” , “Order”, etc.) represents things which need to happen to deliver the project. Note that we don’t add the commands to the board. We found that tracking them added little value. Events and read models were sufficient.</p><p>For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/469/1*TFyzVmmUN8KCUEAaG9qIWA.png" /><figcaption>The hard part: “Iteration 0” implements the ability to create a menu — all the way to production</figcaption></figure><p><strong>The “Menu Created” item is about EVERYTHING that needs to be done to get the ability for users to create a menu, all the way to production.</strong> (In Real Life, we use separate tickets for larger tasks instead of the checklist shown in the example.)</p><p>Note that making the first event (“Menu Created”) happen in production is a lot of work because it entails all the “Iteration 0” activities such as setting up environments and deploy pipelines.</p><blockquote>Getting every event and read model on the project plan all the way to production is crucial: If end users can’t make it happen, it’s not “done”. Early end-to-end integration is worth almost any price because it surfaces integration issues as early as possible.</blockquote><p>Subsequent TODOs such as the “Menu” read model are much simpler:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/808/1*I0BZEPifcq_xqNUQ1JxmRg.png" /><figcaption>Everything that needs to be done so that users can see menus</figcaption></figure><p>When managing projects this way, every task is very clearly related to a measurable business outcome. End users can make “Menu Created” and “Menu Item Added” events happen or they can’t. They can see menus or they can’t.</p><ul><li><strong>Understanding project status becomes trivial.</strong></li><li><strong>Task prioritization is simple:</strong> “I’m doing this first because it’s needed to make “Menu Item Added” happen. Without “Menu Item Added”, there are no menus. Without menus, “Menu Item Selected” and therefore “Order Placed” (to which it is a predecessor) cannot happen.”</li></ul><h3>The “Happy Path” and Alternative Event Streams</h3><p>The example above shows the “happy path” through the system, the series of actions which usually happen, from end to end. There are many alternatives flows, such as:</p><ul><li>Somebody cancels an order</li><li>Menus are updated/edited.</li><li>Menus are deleted.</li><li>Menu items are removed from an order and others are added, or the quantities ordered are changed.</li><li>Accounts are being closed</li></ul><p>We usually build out the “happy path” first because it helps us with getting a “minimum viable product” live as soon as possible.</p><h3>Lessons Learned</h3><p><strong>Event Driven Project Management works great for getting the initial “minimum viable product” live as soon as possible, especially when coordinating and prioritizing work in larger teams.</strong> It’s a lot clearer to everybody what needs to be done when and why.</p><p><strong>We found it less useful after the initial “happy path” is done.</strong> For the simpler ones of the alternative flows and for bug fixes/maintenance we found ourselves switching back to regular tickets and a “traditional” backlog.</p><p><strong>Estimates can be a LOT more precise.</strong> We built an estimating model based on knowing the number of events and read models needed for a new project. For this, we took the hours worked from four projects which we built using this approach and divided those by the total number of events + read models in all past projects. The actual model is a bit more complex than that, with some fudge factors, etc., but it still boils down to:</p><ul><li>“On average, doing all the UI, API, DB, DevOps, etc. work needed to get Order Delivered (or some other event or read model) to production takes X hours of effort.”</li></ul><p>… and …</p><ul><li>“On average, getting an event (or read model) from “we want it” (= it first appeared on the Kanban board ) to “we have it” (= it’s in production) takes X days.”</li></ul><p>Caveat: All the projects in the estimating model were implemented using CQRS &amp; event sourcing. I’m not sure if the same estimating approach would work for something that isn’t event sourced.</p><p><strong>Event driven project management isn’t just for event sourced projects.</strong> When we do legacy migrations or work in traditional non-event sourced code (current state only, no history) we “reverse engineer” the events and plan on that basis: Just because your stack isn’t event sourced doesn’t mean “Order Placed” doesn’t happen. It does. It just isn’t explicit and manifests itself in indirect ways such as (e.g.) inserting a row in an “orders” table.</p><h3>Conclusion</h3><blockquote><strong>“Event Driven Project Management” continues to serve us well in both “traditional” and event sourced systems. The main benefit is that it cuts down coordination overhead and waste because it’s a very intuitive way of prioritizing work.</strong></blockquote><p>There’s nothing new under the sun and although I haven’t heard of anyone else using event storming in this way there’s bound to be something similar out there. Drop me a line at @robertreppel or leave a comment here — happy to answer questions and would love to hear from people who have tried something like this.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6229698c6916" width="1" height="1" alt=""><hr><p><a href="https://medium.com/twotoniclabs/why-it-happens-event-driven-project-management-6229698c6916">Why it happens: Event-Driven Project Management</a> was originally published in <a href="https://medium.com/twotoniclabs">TwoTonic Labs</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>