<?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[Stories by Phil Sarin on Medium]]></title>
        <description><![CDATA[Stories by Phil Sarin on Medium]]></description>
        <link>https://medium.com/@philsarin?source=rss-e1d49e54952d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*AstQr38DZbqNKPNGqttp2g.jpeg</url>
            <title>Stories by Phil Sarin on Medium</title>
            <link>https://medium.com/@philsarin?source=rss-e1d49e54952d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 16:31:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@philsarin/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How serverless tools helped us make good architecture decisions under time pressure]]></title>
            <link>https://medium.com/@philsarin/how-serverless-tools-helped-us-make-good-architecture-decisions-under-time-pressure-4849016feab4?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4849016feab4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[event-driven-architecture]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[serverless]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Fri, 17 Apr 2020 16:17:50 GMT</pubDate>
            <atom:updated>2020-04-19T15:11:28.396Z</atom:updated>
            <content:encoded><![CDATA[<p>Though I’ve left the startup world for now, I’ve spent most of the past 13 years building software at startups. I’ve recently been using Amazon’s serverless stack for a couple of side projects and I’d like to reflect on a non-obvious benefit that several startups might get by using a serverless platform.</p><p>Though the obvious advantage of serverless computing is not having to manage servers, I’ve come to appreciate a second benefit even more. Serverless platforms help us think in terms of events and they make it easier to adopt event-driven architectures under time pressure and on a tight budget. An event-driven architecture was a great fit for a recent project. It helped us deliver faster and improved our flexibility to change.</p><p>In this article, I’ll use as an example my experience building the open source <a href="https://www.stopcovid.co/">StopCOVID</a> SMS <a href="https://github.com/stopcovid-co/dialog-engine">dialog engine</a>. I built it with my former colleague Jeff Silver. We did it in two weeks with great test coverage and monitoring dashboards and we’ve set it up well to scale as demands for COVID-19 training increases.</p><h3>Background on StopCOVID</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/283/1*V8IGQCWB9lBmp2XjP8Blfg.png" /><figcaption>Part of a StopCOVID drill.</figcaption></figure><p>StopCOVID is multi-lingual training platform that helps businesses with COVID-19 safety training. We deliver free training over SMS, with each trainee receiving one daily drill. Each drill has about five questions, and stopCOVID reports statistics on drill completion back to employers.</p><p>When I joined the project, there were two obvious constraints. The first was that we had to be ready to scale. We expected enormous demand for StopCOVID training and we weren’t confident that our Rails backend, initially built for a different purpose, could handle demand. Our second constraint was that we needed to deliver <em>very</em> quickly, because there was obvious urgency in distributing training widely as quickly as possible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/869/1*7ESz0pS0w4kJ7AxIOK36kA.png" /><figcaption>The StopCOVID architecture, simplified slightly for clarity.</figcaption></figure><p>We built the system on Amazon’s serverless platform. The structure (shown in the diagram above) is a straightforward pipeline consisting of streams and Lambda functions. Twilio takes care of SMS sending and receiving for us. Twilio informs us when our users send us messages by calling a webhook, which enqueues each inbound message onto a Kinesis stream. That stream triggers the “dialog core” lambda, which produces events that are written to a DynamoDB table and a DynamoDB stream. That event stream has two consumers:</p><ol><li>A responder, which sends SMS messages back to our users, and</li><li>Analytics, which tracks each user’s progress for reporting purposes.</li></ol><p>We like that we can scale this architecture by increasing the number of partitions of the Kinesis stream. We also like that the architecture has clear boundaries. The boundaries make it easy to reason about and they’ve isolated failures to their respective parts of the system. For example, we’ve had a few bugs in the analytics code that haven’t affected the core of the system. We’re even rebuilding the analytics section, and we can do that without affecting the rest of the system.</p><h3>Serverless deployment and event-driven architecture</h3><p>Strictly speaking, nothing about this architecture required us to use a serverless platform. There’s nothing to prevent non-serverless applications from using streams to distribute events to event-driven stream processors. So the choice to go serverless seems to be completely orthogonal to architecture.</p><p>But, in practice, I’ve found that serverless platforms encourage us to think about events and they take a lot of friction out of building an event-driven architecture. When building an event-driven architecture without a serverless platform, developers need to handle some critical details:</p><ul><li>Ensuring that everything written to the database is written to a message queue/stream, and vice versa.</li><li>Handling failures and initiating retries.</li><li>Tracking the current position in a stream.</li><li>Provisioning the right number of processes. e.g., one process per stream shard.</li></ul><p>Serverless platforms manage these details directly by tightly integrating with event-triggering systems — such as Kinesis or DynamoDB streams, SQS queues, SNS topics, or API gateways. e.g., DynamoDB streams can ensure that every update to a DynamoDB table is delivered to a lambda function. Lambdas can be configured to retry failures or to shunt them to a dead letter queue. AWS automatically tracks where each lambda is currently reading from each stream, and it ensures that one lambda is running per shard—or more than one, if configured.</p><p>By lowering the friction of event-handling, serverless tools make it more likely that teams under time pressure will adopt event-driven architectures.</p><h3>Big payoffs in event-rich domains</h3><p>The advantages of an event-based system really start to show when your domain model is event-rich. It turns out that a lot of domain models are event-rich. A lot of companies today are building systems that manage tons of real-world events—order placement events, inventory stocking events, fulfillment events, payment events, shipping events. At StopCOVID, our domain model includes several events that affect each “dialog” between a user and the system: DRILL_STARTED, DRILL_COMPLETED, PROMPT_COMPLETED, PROMPT_FAILED (on an incorrect answer), and ADVANCED_TO_NEXT_PROMPT.</p><p>In the past, I’ve used a web framework like <a href="https://www.djangoproject.com/">Django</a> to deliver projects quickly under time pressure. With Django or Rails or other web frameworks, there can be a lot of friction in creating, persisting and propagating events while keeping them in sync with the data store. I’ve handled this friction by shying away from event-driven architectures. I’ve instead made compromises in my domain model to work well with the framework. I generally haven’t tracked and persisted every event. I might trigger event handling code ad hoc by firing off asynchronous tasks using a library like Celery. Sometimes I might poll the database to detect that an event occurred. Or I might rely on Django’s anemic “create”, “update” and “delete” signals to infer that an event occurred.</p><p>Failing to accurately track and persist events can have frustrating consequences. Code that’s especially event-dependent (e.g., notifications and webhooks) can get really grungy and brittle. The full history of events may not matter for user-facing UIs, but it’s often critical for analytics and accounting teams. And it’s too easy for seemingly innocuous data migrations to mistakenly trigger event handlers and cause embarrassing downstream consequences, such as emailing the entire user database.</p><p>Amazon’s serverless toolset gave us a simple way of solving these problems on the StopCOVID project:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/542/1*mfqRE38h3c97y0lV5LAgbw.png" /><figcaption>The StopCOVID dialog system. The “dialog core” lambda updates state and writes events to DynamoDB. Those events get auto-propagated to downstream consumers including a messaging consumer (which replies to the user) and an analytics consumer.</figcaption></figure><ol><li>Our “dialog core” lambda function wrote state and events to DynamoDB in one transaction.</li><li>The events were automatically propagated to a DynamoDB stream.</li><li>Our two downstream consumers lambdas were automatically triggered by each event, in order.</li></ol><p>This is pretty cool. The system writes all events to DynamoDB in an append-only fashion. The downstream lambdas only fire when an event is triggered — not during a data migration (though they do the right thing if they get invoked with an old event). They fire in order, and the platform handles retries.</p><h3>A regret: Ditching the ORM</h3><p>When we ditched web frameworks like Django and Rails, we also ditched their Object-Relational Mapping (ORM) system such as the ActiveRecord library from Rails. We had mixed results in abandoning an ORM.</p><p>In the “dialog core” module at the center of the diagram above, this choice worked out really well. As the simplified code excerpt below shows, we had to do very simple key-value database operations that didn’t benefit from an ORM: looking up dialog state based on phone number and writing then writing back dialog state and events. The actual processing logic (command.execute and event.apply_to from the code sample) did not have any dependencies on a database. Having database-independent processing logic allowed us to write a simulator that tested our core module with input from a command-line interface.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gU3gVQ2xRjik-s-PLjT9CA.png" /><figcaption>Simplified version of our command processing engine.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_C0hfHyBvT2yU3BnwNkISA.png" /><figcaption>Our simulator, which used command-line inputs instead of text messages to exercise our core module.</figcaption></figure><p>But we wish we used an ORM in other parts of our application. Our analytics consumer reacted to each dialog event by updating reporting information in a SQL database. It had to do several SQL queries, and hand-rolling those queries using <a href="https://docs.sqlalchemy.org/en/13/core/">SQLAlchemy core</a> was time-consuming and brittle. Because analytics wasn’t on the critical dialog path, we didn’t gain any advantage from slightly better performance of our hand-rolled queries. We are rewriting that component to use an ORM.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9YzwcQhTh98tNa-t1gWTlA.png" /><figcaption>A hand-rolled SQLAlchemy core query that makes us sad</figcaption></figure><h3>Not a silver bullet, but a step forward</h3><p>Amazon’s serverless platform gave us a set of tools that helped us create a maintainable and flexible architecture under time pressure. That event-driven architecture had some unexpected positive side-effects, including our ability to build a simulator and our ability to isolate failures to specific parts of the system. Because we were using Amazon tools out of the box, we could easily visualize the behavior of our system by using standard metrics from Cloudwatch, exported to <a href="https://p.datadoghq.com/sb/xf16zki4axz5uxp1-086b0e9c78d058862660a6a77eac01bb">a Datadog dashboard</a> without any custom code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RKu6osH4IcK1pWB5wkbiTA.png" /><figcaption>Part of our Datadog dashboard, generated with metrics provided out of the box by CloudWatch</figcaption></figure><p>But equally important: we did this work quickly, in less than two weeks with two engineers. Quality was great from day one, and, because we had strong test coverage and thorough monitoring dashboards, we could easily adapt to changing requirements.</p><p>Of course, good tools don’t guarantee good architecture. It’s hard to figure out the right high-level breakdown of a system. It’s hard to figure out what events exist and what objects each event should apply to. It’s tricky to choose the right data stores and to configure partitioning correctly at scale. It’s hard to ensure the right levels of consistency and fault tolerance.</p><p>Serverless platforms have their gotchas, including cold starts, as covered by <a href="https://medium.com/@emaildelivery/serverless-pitfalls-issues-you-may-encounter-running-a-start-up-on-aws-lambda-f242b404f41c">this excellent retrospective</a> by the EmailDelivery.com team. The StopCOVID project may have benefited from a workload that was especially well suited to a fully serverless backend. The impact of cold starts on the SMS-based StopCOVID user experience was negligible. I’d want more control over performance if I were building something that was responding to live web or API requests.</p><p>We also handled all of our orchestration manually — wiring streams, queues and lambdas together manually. I’m curious to explore where we could have benefited from <a href="https://aws.amazon.com/step-functions/">AWS Step Functions</a>.</p><p>I’m interested to hear from other startup teams who are building serverless applications. How is your system better than ones you previously built? What’s frustrating you about working with serverless technologies? How do you decide which parts of your system are built with serverless technologies? Would you recommend that others go serverless-first?</p><p><em>If you know an organization that would benefit from StopCOVID, please send them to </em><a href="https://www.stopcovid.co/"><em>our site</em></a><em>. </em><a href="https://github.com/stopcovid-co/dialog-engine"><em>Our code is available on an MIT License</em></a><em>, so feel free to use any parts of it if they are helpful. Thanks to Jeff Silver, Kai Yen and the StopCOVID team.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4849016feab4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Thinking critically about web frameworks like Django and Rails: Part 1]]></title>
            <link>https://medium.com/@philsarin/thinking-critically-about-web-frameworks-like-django-and-rails-part-1-f91e6802f384?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f91e6802f384</guid>
            <category><![CDATA[distributed-systems]]></category>
            <category><![CDATA[django]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Tue, 07 Jan 2020 15:09:50 GMT</pubDate>
            <atom:updated>2020-01-08T00:49:16.343Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Our thoughts are filled with brave, fierce, passionate actions: we live, we breathe, we walk, we talk, we laugh, we cry, we hope, we fear, we eat, we drink, we stop, we go, we take out the garbage. Above all else, we are free to <em>do</em> and to <em>act</em>. If we were all just rocks sitting in the sun, life might still be OK, but we wouldn’t be free. Our freedom comes precisely from our ability to <em>do</em> things.</blockquote><p>— Steve Yegge, <a href="http://steve-yegge.blogspot.com/2006/03/execution-in-kingdom-of-nouns.html">Execution in the Kingdom of Nouns</a> (March 2006)</p><p>Fifteen or so years after they debuted, web frameworks like <a href="https://rubyonrails.org/">Ruby on Rails</a> and python’s <a href="https://www.djangoproject.com/">Django</a> framework remain popular ways to build applications. They’ve always been a great way to get something up and running quickly. Several influential companies got their start using these frameworks. And, though some have argued that “Rails doesn’t scale”, people <a href="https://engineering.shopify.com/blogs/engineering/e-commerce-at-scale-inside-shopifys-tech-stack">have proven that wrong too</a>.</p><p>Yet in this series of posts I’m going to argue that these frameworks can slow down development of some kinds of applications. My first two posts are going to cover some drawbacks that I’ve stumbled upon. The third post is going to propose an alternative approach.</p><p>My focus for this post is a feature of these frameworks that is both a huge strength and a problem—CRUD. CRUD stands for “create, read, update, delete,” four operations that we can perform on an object. Django and Rails help us build applications quickly by making it really easy to implement the CRUD operations The benefits and drawbacks of CRUD extend to REST, the dominant way of building APIs. The four CRUD operations correspond directly to the HTTP verbs (GET, POST, PUT, etc) that are the foundation of REST.</p><p>There are cases where CRUD and REST will slow down development. But before I get into that, let’s review how CRUD encourages us to think about our applications.</p><h4>The kingdom of nouns</h4><p>CRUD encourages us to think about domain modeling in a particular way. What is domain modeling? Here’s a definition from <a href="https://en.wikipedia.org/wiki/Domain_model">Wikipedia</a>:</p><blockquote>A domain model is a conceptual model of the domain that incorporates both behavior and data.</blockquote><p>As the definition says, domain models consist of behavior and data — verbs and nouns. For instance, in a ride sharing app, the domain model may include nouns like Driver, Rider, and Ride and verbs like request a ride, pick up, and drop off.</p><p>CRUD simplifies our domain models by limiting us to four verbs, only three (create, update, and delete) of which can trigger mutations. CRUD focuses us on the nouns, though we can convert a verb into a noun using a sleight of hand. For example, instead of saying that a Rider requests a ride , we might say that we create a RideRequest.</p><p>Restricting ourselves to four verbs is a powerful simplification that can save us a lot of time. That simplification is at the core of why it’s so easy to build applications quickly with Rails and Django. HTTP verbs correspond directly to CRUD actions, which correspond directly to SQL operations. We can define a model once. CRUD frameworks supply the glue, by supplying SQL statements, REST APIs, and even <a href="https://docs.djangoproject.com/en/3.0/ref/contrib/admin/">auto-generated administrative UIs</a>.</p><p>But when these simplifications aren’t a good tradeoff, development can take <em>longer</em>. The framework-supplied glue that is so helpful works against us, and we end up doing more work. As an example, I’ll use a system that my team worked on at Managed by Q.</p><h4>When a noun-based design was expensive to extend</h4><p>Managed by Q (Q for short) runs a facilities management marketplace. The marketplace’s clients include small businesses who need facilities services such as office cleaning and maintenance. We help those clients find trusted facilities vendors.</p><p>Our marketplace included an <em>ordering system</em> and a <em>billing system</em>. The ordering system would allow clients to request service (e.g., regular office cleaning) and would match them with a vendor from our network. After the client and vendor agreed on the work to be done and on the price, the vendor would begin work. The billing system would send bills to our clients and would then distribute payment to our vendors. For many services, we billed our clients on a monthly basis.</p><p>The ordering system and the billing system were separate at first. Though our ordering system contained the price our clients and vendors had agreed upon, our billing system didn’t have access to this information and it didn’t know when to send bills. We only billed our clients when our vendors emailed invoices to us. Our operations associates would receive those invoices and manually create bills for our clients. We wanted to integrate the ordering and billing systems, because doing so would reduce errors, would make bills clearer, and would increase efficiency. But integrating the two systems required some new features in our ordering system:</p><ul><li>Orders needed to support <strong>both recurring and non-recurring changes</strong>, such as a price increase (recurring) or a one-time surcharge (non-recurring).</li><li>We needed to know <strong>when clients started and ended service</strong> so that we could prorate monthly bills.</li><li>The ordering system needed to handle <strong>changes of vendors</strong>. A vendor change should trigger two bills in the month of the change, one for the old vendor and one for the new vendor.</li></ul><p>We built the pre-integration version of the ordering system using the Django framework and a set of nouns like Client, Vendor, Order and Quote. We tried to handle the billing integration requirements by introducing new nouns. It was doable but it took a lot longer than we expected.</p><p>We struggled to capture the new requirements. We created a noun called Job that captured all of the billable line items that would be billed to a client in a single billing period. Job was a strange term for the concept and we weren’t satisfied with it, but our alternatives were equally unsatisfying. We could handle all of our new requirements with Job objects:</p><ul><li><strong>Recurring and non-recurring charges:</strong> We pre-generated Job objects for several months in advance. New charges could be attached either to the Order (for recurring charges) or to a specific Job (for one-time charges).</li><li><strong>Start and end dates: </strong>Each Job included a service window, which we used to prorate charges.</li><li><strong>Vendor changes:</strong> For the month in which the old Vendor and new Vendor would overlap, we’d create two Job objects, one for each Vendor.</li></ul><p>We spent a <strong>lot</strong> of time handling the edge cases around creating and updating Job objects. Some operations, like vendor changes, would require us to delete and regenerate Job objects. There were complicated workflows (and even more nouns) for making changes that became effective on future dates. We had to do a ton of intricate migrations and backfills. Even after we delivered a working system, we left a team to refactor these parts of the code because it was so confusing.</p><p>In hindsight, a simpler and more natural way of handling the problem was to rely on the verbs in our domain model. The representation of an Order could have included a sequence of events (verbs) such as service start scheduled, service cancelled, vendor changed, charge added, and price changed. By designing around a noun like Job, we forced ourselves to <em>proactively</em> create and update our Job objects as these events happened. It would have been simpler to create a billing statement <em>retroactively</em>, by gathering all events that occurred since the last statement and assembling them into a bill.</p><h4>CRUD events made downstream integration hard</h4><p>Billing automation wasn’t the only place where a noun-based worldview limited us. We hit problems when we needed to inform downstream systems about changes to orders. For example,</p><ul><li>Our <strong>customer relationship management (CRM)</strong> system, salesforce.com, needed to be updated with order-related actions.</li><li>We needed to <strong>send notifications</strong> by email or SMS to clients or vendors. For instance, if a client approved a quote, we’d send the vendor an email to let them know.</li><li>Our <strong>monitoring system</strong> needed to know about various events. For instance, we would verify that we eventually sent an email whenever we invited a vendor to submit a quote. We did so by informing our monitoring system whenever we sent an email and whenever we invited a vendor to quote. The monitoring system would correlate those two events and would surface discrepancies.</li></ul><p>These downstream systems had a common need that our design handled poorly. The CRUD update operation wasn’t granular enough for us to figure out what actions we’d need to take in a downstream system. In our design an update for the start or end date of an Order would trigger an update event. So would a price change. But date changes and price changes had different consequences in our downstream systems. We’d make different updates in our CRMs. We’d send different emails. Our monitoring system would look for different subsequent operations.</p><h4>Moving beyond “updates”</h4><p>In our example at Q, we needed to model our verbs explicitly and to persist events after applying our verbs. This isn’t the idiomatic approach with CRUD frameworks, and so it’s easy to get it wrong, as we did initially at Q. It’s also possible to get it right.</p><p>One approach is to create special purpose endpoints, such as /quotes/invite-vendors/, for each verb. This endpoint could update our nouns and store granular events that would be available for collation later. It could also trigger the appropriate changes in downstream systems. This approach is an example of a remote procedure call (RPC) interface, which we could also implement using an RPC protocol like gRPC.</p><p>Another way to solve the same problem is to create a new RESTful resource for each event. For example, a POST to /quotes/123/invitations could persist a new QuoteInvitation object. While handling the create operation of the granular QuoteInvitation object, we could make specific updates to objects and downstream systems. We could view this approach as within the bounds of REST and CRUD, except that we would forbid update and delete operations and would instead create new instances of immutable objects.</p><p>In my opinion the choice between these two approaches is an implementation detail. With either approach, we’ve looked beyond a noun-based design and we’ve overridden the framework’s default way of handling mutations. We’re replacing update and delete operations with a catalog of granular verbs. This change isn’t the idiomatic way to build with CRUD frameworks, but the frameworks can handle it. In Part 3 of this series, I’ll cover another approach.</p><h4>When verbs matter</h4><p>This series isn’t arguing that “Rails sucks” or “Django sucks.” As I noted above, there are ways to build a more verb-centric design while continuing to use these frameworks. But those approaches overrode the CRUD frameworks’ default way of handling mutations.</p><p>The question I’d like you to ask is, how much do verbs matter in your domain? For a newspaper site, a blog, and a to-do list (among other things) create, update and delete events may capture the domain model really well. You’d unambiguously win by using a CRUD framework and all of the built-in tooling that comes with it. But if the granular verbs matter a lot in your problem domain, there are fewer advantages to using a CRUD framework.</p><p>A common type of verb-heavy system is a <em>workflow system</em>. Lots of companies are building systems to manage service delivered in the physical world. Examples include ride-sharing, home-sharing, direct-to-consumer brands, and transportation logistics. These companies build systems to ensure that real people do high-quality work in the right place and at the right time. The verbs are the core of these systems. You’ll save work by modeling them from the beginning.</p><p>The verbs-and-nouns question isn’t the only limitation that we hit with a CRUD framework. In Part 2 of this series, I’ll talk about another issue that we had to work around. In Part 3, I’ll propose tooling that may be a better fit.</p><p><em>Thanks to Matt Briançon, Alex Etling, Tim Finkel, John Lucas, Seth Purcell, Nick Schultz and Jeff Silver for reviewing this post, and thanks to all of my colleagues at Managed by Q for learning these lessons in real time with me.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f91e6802f384" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to plan a microservices migration]]></title>
            <link>https://medium.com/@philsarin/how-to-plan-a-microservices-migration-9b4ac50dfa95?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b4ac50dfa95</guid>
            <category><![CDATA[architecture]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[microservices]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Thu, 14 Nov 2019 12:36:19 GMT</pubDate>
            <atom:updated>2019-11-14T12:36:19.773Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/783/1*vtiVNhU35AT1MvTEXGUTug.png" /></figure><p><em>Terminology note: The term microservices means different things to different people, largely because of the “micro” part. In this post, I’m using the term microservices to refer to independently deployed services, big or small, that don’t share datastores and that communicate through well-defined interfaces.</em></p><p>When I was the CTO of Managed by Q, I started a transition to a microservice architecture and then halted the transition years later. I learned a few hard lessons along the way and I now think it’s possible to anticipate most of the problems we ran into. In this post, I’ll talk about how to plan for a microservices migration. A good plan will save you a ton of time in your migration and may even convince you that a microservices architecture isn’t the right solution to your problem.</p><p>Our initial plan was small and iterative. Lean and agile software methodologies have popularized small, iterative plans as a way to learn quickly about a problem space. I’d successfully used iterative planning to ship countless features, to repair unreliable production systems and to help struggling teams deliver. It seemed like the right approach for a microservices transition. The number of details to consider was daunting and I was concerned that we’d never get started if we overthought it.</p><p>We envisioned a set of decoupled services owned and independently developed by individual teams. It seemed like an ideal fit for Q’s complicated service marketplace. We would start by extracting a pilot service and would use the lessons from the pilot to inform our architectural and tooling choices. As we extracted each service, we’d discover problems that we needed to solve and we’d improve our approach.</p><p>I now wish I’d made a more complete plan up front. I glossed over some important details by under planning. We ran into a set of predictable problems that others had encountered. We revisited decisions that were expensive to change and under-prioritized some of the infrastructural work that helped us to build productively.</p><h4>Why were we thinking about microservices?</h4><p>In early 2016 our architecture was failing us. We’d taken a bunch of shortcuts to get to market. Only two years into the history of the business, those shortcuts were already creating bad experiences for our users and were limiting our ability to grow.</p><p>The core of the problem was tight coupling, which limited our flexibility to change our systems. We adopted some embarrassing workarounds to deal with these limitations. For instance, our clients had to use fake email addresses to manage more than one office location on our platform. They couldn’t view all their charges on one bill. We often let clients order services that were unavailable to them.</p><p>Microservices aren’t necessary to solve these problems. But I believed that splitting our system into separate microservices would provide guard rails that made coupling less likely. I also believed that we would increase each team’s sense of ownership by eliminating services that were shared between teams. We had only 15 people on our team but were projecting a lot of growth. I favored starting on the migration so that we could learn our lessons before our team was huge.</p><h4>What actually happened</h4><p>As we started to extract services we quickly found that a multi-service environment created pain points in day-to-day development. Local development was annoying as we had to figure out how to run multiple services locally and how to bootstrap them with consistent data. Communication between services was frustrating; we had to enable our services to authenticate with each other and we also had to configure SNS topics and SQS queues for asynchronous communication. We had to figure out how to handle errors in inter-service communication and we later regretted that we lacked schemas for our messages.</p><p>We also didn’t realize a benefit that we were hoping for. It didn’t make sense for individual teams to own services at our size. Our business frequently changed and so ownership felt arbitrary. Teams often needed to work on services that they didn’t formally own. They also had to formally own services that they rarely worked on.</p><p>As we encountered difficulties with microservices we slowed our migration down. We built tooling to reduce our pain points. We weren’t surprised that the migration was painful and we weren’t surprised that we had to build tools. We were surprised by the amount of work required to solve the problems we ran into. We eventually decided that the benefits we saw from our new services weren’t great enough to continue investing in tools. We stopped adding new services and even eliminated a few of them.</p><p>We were able to develop our first service within few weeks, but I didn’t realize in advance how costly it would be to get our team fully productive with developing microservices. With a rough sketch of those costs I might have taken a different approach and prioritized differently. In hindsight, some additional planning would have helped us recognize some predictable costs, to appreciate a key tradeoff, and to prioritize our work better. The problems we saw weren’t novel. Other teams will see the same issues and can learn from our experience.</p><p>The next time I try to do an ambitious rearchitecture project, I’ll start by building a <em>context map</em> and an <em>infrastructure roadmap</em>.</p><h4>The context map</h4><p>A context map identifies all the “<a href="https://martinfowler.com/bliki/BoundedContext.html">bounded contexts</a>” in a system and explains how they communicate with each other. The term comes from <a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/"><em>Domain-Driven Design</em></a>, a classic 2003 book by Eric Evans. A bounded context is a subdivision of a larger application, intended to focus on a part of the problem domain. For example, Managed by Q’s office services marketplace could have had bounded contexts for search/browse, ordering, fulfillment, messaging, and billing.</p><p>I found the concept of bounded contexts to be confusing. I only really began to grasp them when I took a few days off of work and repeatedly read through parts of Evans’s book, <a href="https://www.amazon.com/Domain-Driven-Design-Distilled-Vaughn-Vernon-ebook/dp/B01JJSGE5S/"><em>Domain-Driven Design Distilled</em></a> by Vaughn Vernon, and <a href="https://www.amazon.com/Implementing-Domain-Driven-Design-Vaughn-Vernon-ebook/dp/B00BCLEBN8/"><em>Implementing Domain-Driven Design</em></a><em> </em>(also by Vernon). <a href="https://www.amazon.com/Microservices-Patterns-examples-Chris-Richardson/dp/1617294543/"><em>Microservices Patterns</em></a>, published more recently, has a good example of the concept. Or, one of the workshops at the <a href="http://exploreddd.com/">Explore DDD</a> conference may be a faster way to learn the same material.</p><p>A <a href="https://dzone.com/articles/ddd-thinking-in-terms-of-context-map">context map</a>, described in Chapter 14 of <em>Domain-Driven Design</em>, identifies not only what the bounded contexts are but also how they communicate with each other. Some bounded contexts communicate with others through a well-defined interface. But in non-ideal real systems, contexts may share implementation details such as database tables. Or some contexts may be implemented in third-party tools or other software that can’t be changed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*FQs4CnkjoO-bL2fWM-hYkw.png" /><figcaption>A partial context map. See Chapter 14 of Domain-Driven Design<em> for more details.</em></figcaption></figure><p>It’s very unlikely that you’ll get your context map perfectly right the first time. Chances are that your business is changing (as ours was) and that the context map might get partially invalidated as times goes on. But getting context boundaries wrong is a very expensive problem to fix. Even an imperfect draft of a context map can reduce future rework.</p><p>Note that the context map is independent of whether you do microservices. Each bounded context may be implemented by its own microservice. It’s also possible for multiple microservices to implement one bounded context. And it’s possible for all bounded contexts to live in the same monolith. Each approach requires different implementation details, which the next section covers.</p><h4>The infrastructure roadmap</h4><p>There are several approaches to translating your context map into code. Two of those approaches are keeping your monolith and breaking it into microservices. There may also be alternatives that involve breaking out parts of the system or relying on third-party tools.</p><p>No matter what approach you take, you will need to build infrastructure in order to productively build a loosely coupled system. The infrastructural needs are very easy to predict because nearly every team that builds microservices needs to solve the same set of concerns. It also pays to get these infrastructural concerns close to right the first time. Changing your mind is expensive as it often requires you to modify <em>all</em> of your services.</p><p>Once you have more than one bounded context, much of your infrastructural needs will revolve around <em>eventual consistency</em>. Whether implemented within microservices or within a monolith, your bounded contexts need to communicate with each other. Often they need to be consistent with each other. e.g., the billing context needs to receive data from the ordering context so that a customer is billed for an order. Strong consistency between contexts is usually not a good design choice because it requires either tight coupling (by sharing database transactions) or support for distributed transactions. Eventual consistency is usually a better choice and many teams implement eventual consistency using asynchronous messaging systems. Many web frameworks (including Django, which we used) make tightly coupled, strongly consistent systems much easier to build than loosely coupled, eventually consistent ones. If you’re already committed to such a framework you may need to build infrastructural tools to fill the gap.</p><p>For <em>each architectural option</em>—monolith, microservices, and hybrids—that you’re considering, I’d sketch out an infrastructure roadmap. The roadmap is a prioritized list of tooling that will help you develop your application. You won’t need to implement your entire roadmap to get started but having visibility into what infrastructural tools you’ll need will help you recognize tradeoffs and decide priorities. The roadmap should cover at least the following areas.</p><p><strong>External Communication</strong></p><p>How your contexts communicate with the outside world such as web browsers or mobile apps. Do they use REST or an RPC protocol like gRPC?</p><p><strong>Inter-Context Communication and Eventual Consistency</strong></p><p>For any asynchronous messages, is the format text (e.g., JSON) or binary (e.g., avro, protocol buffers)? What messaging technologies do you use? (e.g., SNS, SQS, Kinesis, Kafka, RabbitMQ, some tables in your own database) How do you handle out of order messages and repeated messages?</p><p><strong>Authentication and Authorization</strong></p><p>How do people authenticate with your system? How do services (if you use them) authenticate with each other? How do you check that a user (whether person or machine) is authorized to perform an action?</p><p><strong>Deployment and Operations</strong></p><p>How do you deploy to production? How do you monitor that the system is working correctly? How do you do service discovery?</p><p><strong>Upgrades and Patching</strong></p><p>How do you ensure that patches (especially security patches) are promptly applied, even to services that aren’t actively being developed?</p><p><strong>Local Development</strong></p><p>How will developers develop against your system locally? Will they test against production, use a staging environment, or seed test data locally? How will they test against other systems that their code depends on?</p><p><strong>Validation and Standards</strong></p><p>What are your standards for writing code and APIs? How do you enforce those standards? Do you rely on schemas or type checking? Where do you manage and version your schemas/types?</p><h4>Tradeoffs</h4><p>Context maps and infrastructural roadmaps would have helped us to make our tradeoffs more explicit and to act on them more quickly. A critical tradeoff that emerged was between the speed to decouple our application and the level of isolation between our teams.</p><p>The fastest way for us to decouple our application would have been to refactor our monolith. Keeping the application monolithic would reduce the complexity and costs of the solutions we’d need for inter-context communication, local development, authentication/authorization, deployment, operations, validation, and standards enforcement. At our relatively low traffic scale, it was far cheaper to build the necessary infrastructure for a monolithic application. We could have relied on our database for inter-context communication and could have enhanced the tools we were already using to address the other concerns.</p><p>But the down side of developing within the monolith is that we’d have weaker isolation between teams. Our teams wouldn’t fully own the operations and maintenance of their contexts. There would have to be some cross-cutting coordination to handle library upgrades and security patches. A single broken build could block all of engineering. A bad query in one part of the application could bring down the whole thing.</p><p>This tradeoff wouldn’t be a permanent one. If we designed our contexts not to share database tables, to use eventual consistency instead of shared transactions, and to communicate through shared interfaces (see <a href="https://fideloper.com/hexagonal-architecture">hexagonal architecture</a>), we would retain the option to extract our contexts into microservices in the future. We wouldn’t permanently forego the infrastructural tooling to support microservices but we’d prioritize it behind the work that enabled decoupling within our monolith.</p><p>Had we considered the vast difference in scope between the monolithic infrastructure roadmap and the microservices infrastructure roadmap, I think we’d have opted to stay monolithic for another couple of years. Our team was small. We didn’t have performance problems that microservices would address. We had no hard requirements to use multiple programming languages.</p><h4>Lessons</h4><p>The migration to microservices wasn’t an outright failure. We did eliminate the points of tight coupling that led us to start along the microservices path in the first place. We also successfully completed (after thorough planning) other ambitious rearchitecture projects. But we wasted some effort along the way.</p><p>This experience helped me appreciate the limits of lean, iterative planning. Iterative planning helped us learn as we went along but it delayed lessons that other companies had already learned. It surfaced important tradeoffs late and led us to avoidable rework. Time spent planning our approach in more detail would have been well spent.</p><p>The experience humbled me. I wish I’d recognized that I was overwhelmed and needed help. None of us were experienced with microservices transitions and we were simultaneously dealing with an aggressive feature roadmap, technical debt, and other challenges of an early stage startup. Possibly an outside consultant who had been through a couple of rearchitecture projects could have advised us. With outside help, we could have created a better plan, surfaced tradeoffs sooner, and saved some time.</p><h4>Helpful resources</h4><ul><li><a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/"><em>Domain-Driven Design</em></a></li><li><a href="https://www.amazon.com/Enterprise-Integration-Patterns-Designing-Deploying/dp/0321200683/"><em>Enterprise Integration Patterns</em></a><em>. It’s common to build eventual consistency with asynchronous messages. This book has good coverage of that topic.</em></li><li><a href="https://www.amazon.com/Microservices-Patterns-examples-Chris-Richardson/dp/1617294543/"><em>Microservice Patterns</em></a><em> </em>(for lots of other patterns, including good patterns for ensuring eventual consistency between a database and a messaging system)</li><li>Mike Bryzek’s excellent talk, <a href="https://www.youtube.com/watch?v=j6ow-UemzBc&amp;t=17s">Design Microservice Architectures the Right Way</a>, for a sense of how much tooling is required to do microservice architectures well.</li></ul><p><em>Thanks to Rohi Bagaria and Travis Thieman for their help with this post.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b4ac50dfa95" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Farewell to Q]]></title>
            <link>https://medium.com/@philsarin/farewell-to-q-327b915663bc?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/327b915663bc</guid>
            <category><![CDATA[startup]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Mon, 19 Aug 2019 19:29:45 GMT</pubDate>
            <atom:updated>2019-08-19T19:52:42.548Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*csixpXt3AJ15qVKcF52htw.jpeg" /><figcaption>One of the few days in 19 years that I’ve worn a T-shirt to work!</figcaption></figure><p>This week is my last as Managed by Q’s CTO. I’ll be moving into a different role on WeWork’s technology team. It’s a great opportunity for me. I’m going to be an individual contributor in my next tour of duty — I’m beyond thrilled at that. The opportunity to build things again is exciting to me, and I’m looking forward to getting started. More details are TBD and I’ll share when I have them. I’m also happy to announce that Andy Parsons will be joining Q as our new CTO. More on him below.</p><p>What’s odd about my transition is that I’m leaving at a time when things are going really well. We’re solving problems for an underdog of the business world — an office manager. In my time at Q, speaking to and building for office managers, I’ve come to realize how important they are to the culture and function of a business. There’s so much we can do to make their lives better and to increase their impact. What we’re building will come to light over the coming months. I’ll say that I’m excited about it and that I can’t wait.</p><p>Q is an amazing place. When we were independent, we experienced the roller coaster of emotions that all startups go through. Building a business from scratch is hard and each milestone is more difficult than the last one. We had the missteps that are common when navigating through a thick fog: we sometimes confused urgency with importance, we sometimes lost sight of what really mattered to our customers, and we sometimes let our natural fears make us tentative.</p><p>But the team responded to those setbacks in a way that gives me high confidence in the future of Q. They decided to be bold again and to change what had to be changed. They went back to the basics of business and decided to build a better product, with the conviction that office managers need great tools. Nearly a year into this transformation, we were acquired by WeWork, who gave a strong endorsement of this vision.</p><p>That last year of change was the most satisfying for me at Q. It was also a year for which I deserve little credit. The transformation happened from the bottom up, with individuals from all levels of the organization recognizing what needed to be done, passionately fighting over the details, and rallying their colleagues to the cause. And over that time we’ve been steadily revamping core parts of the product and the technology.</p><p>Dan Teran deserves the highest praise for building a team that could rise to every unforeseen challenge, that stuck together through the ups and downs, and that transformed our culture and our strategy when they needed to. Though we like to say that we don’t design around people, our people saved us when the designs didn’t work. Those people, now in their third or fourth roles at the company, are leading us today.</p><p>Andy Parsons is an ideal CTO for Q’s next stage. He’s founded companies and he’s also run teams, big and small, over a technology leadership career that’s spanned more than two decades. Andy has the experience and wisdom to lead technology at Q. But even more so, he has the right values. He has high standards, he’s a great listener, and he can dive into the weeds when he needs to. He’s also an active member of the community: he’s built a great network, he’s mentored startups, and he runs the Clojure/nyc Meetup.</p><p>I’ll miss the folks on my former team that Andy will get to work with. I’m grateful to them for sticking around through the years, for doing the dirty work that I didn’t always give them credit for, and for being unfailingly supportive of each other. Nearly every candidate we’ve spoken with has remarked on the caliber <em>and</em> friendliness<em> </em>of the people on the team. But don’t let that friendliness fool you. These folks deliver.</p><p>It’s been an honor to be part of this journey. Thanks to our great engineering and data managers and to everyone on my teams. Thanks to Dan, my peers on the executive team, and to everyone at Q.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=327b915663bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Senior engineers and interpersonal skills]]></title>
            <link>https://medium.com/do-not-erase/senior-engineers-and-interpersonal-skills-542d122de3ce?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/542d122de3ce</guid>
            <category><![CDATA[engineering-mangement]]></category>
            <category><![CDATA[career-development]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Thu, 23 May 2019 22:03:05 GMT</pubDate>
            <atom:updated>2019-05-24T14:11:11.180Z</atom:updated>
            <content:encoded><![CDATA[<p>How can individual contributor engineers advance in their careers? My favorite article on the subject is <a href="https://www.kitchensoap.com/2012/10/25/on-being-a-senior-engineer/">John Allspaw’s </a>“On Being a Senior Engineer.” In arguing that engineering seniority goes beyond technical skills, he states, “I expect a “senior” engineer to be a mature engineer.”</p><p>His idea resonates with my experience. The best senior engineers I’ve known have a way of making big things happen. They don’t just know stuff. They don’t just get things done. They can change an entire team’s approach to a problem and they can do it quickly. I’ve sometimes struggled to explain what it looks like for someone to wield that power.</p><p>We recently did an analysis of our career ladder that suggested a similar conclusion: engineers who are more senior don’t derive their impact from superior technical knowledge alone. They exhibit a skillset that makes others around them better.</p><p>Some years back, we adopted a slightly modified version of <a href="https://github.com/artsy/README/blob/master/careers/ladder.md">Artsy’s career ladder</a>. To make it easier to understand, Maria Dunn, our VP of People and Culture, suggested that we group the 45 competencies into themes. We found seven categories: Knowledge of engineering practices, Knowledge of Managed by Q systems, Execution skills, Mentorship, Impact, Technical strategy, and Evangelism.</p><p>It was fascinating to zoom out on the categorized career ladder. The knowledge and execution criteria, such as “Acknowledged as an expert in a particular service or technology area,” were clustered towards the more junior roles. That is, early in a career, advancement depends on knowing more stuff and on getting things done. But towards the middle of our career ladder, more criteria started to map towards the “influence” roles: Mentorship, Impact, Technical strategy, and Evangelism.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/0*6t4j3cBuc_OhQ39i" /><figcaption>Our IC career ladder, zoomed out. Rows are our levels, ordered from junior to senior. Columns are categories of competencies. There’s a visible trend of junior roles demanding knowledge and execution competencies while senior roles require engineers to demonstrate more interpersonal competencies.</figcaption></figure><p>This lesson is similar to the lesson from John Allspaw’s post: interpersonal, non-technical skills are essential for individual contributor engineers to advance in seniority. I don’t mean to say that technical and execution skills are unimportant — the skill required to build something like Google search is obviously extraordinary. But even at that level of technical complexity, the ability to communicate ideas and influence others is essential.</p><p>Have a look our at our categorized career ladder <a href="https://docs.google.com/spreadsheets/d/11zyseK3ap_LXK--m-wvduxoV--lYoa9pHORSY6Bgmi4/edit#gid=0">here</a>. (For what it’s worth, this ladder will be short-lived. Shortly after we categorized our career ladder, we were acquired by WeWork. WeWork’s ladder has principles that are similar to our seven categories, which made it easier for us to adopt their system.)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=542d122de3ce" width="1" height="1" alt=""><hr><p><a href="https://medium.com/do-not-erase/senior-engineers-and-interpersonal-skills-542d122de3ce">Senior engineers and interpersonal skills</a> was originally published in <a href="https://medium.com/do-not-erase">DO NOT ERASE.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Moving to three-person engineering teams]]></title>
            <link>https://medium.com/do-not-erase/moving-to-three-person-engineering-teams-bcf599670c2a?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/bcf599670c2a</guid>
            <category><![CDATA[engineering-mangement]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Thu, 18 Oct 2018 18:25:22 GMT</pubDate>
            <atom:updated>2018-10-18T20:10:31.798Z</atom:updated>
            <content:encoded><![CDATA[<p>Three-person engineering teams just work better. Everyone on a three-person team is more motivated because they feel like they <strong>own </strong>their work. They also deal with less overhead and nonsense. Yet three-person teams aren’t too small. They have just enough people to handle vacations or to swarm on complicated problems.</p><p>But three-person teams aren’t as frequent as they should be because they can be hard to pull off. It can be hard to find enough team leaders. It’s also tempting to build larger teams to handle bigger mandates. At Managed by Q, three-person teams were commonplace when we had fewer than ten engineers who were cranking out the foundation of our technology platform. But as we grew to close to 25 people, our teams swelled in size to five or six people. Everyone gradually became a little less motivated. And everything slowed down.</p><p>A few months ago we decided to break up our larger teams and to return to three-person teams as our default size. As we’d hoped, the three-person teams were more motivated and they delivered more. In our post-reorg survey, team members praised higher speed and greater ownership:</p><blockquote>Small size = very fast development. Able to have total mental model of the code we’re working on. Nobody is able to be left out or lag behind in understanding.</blockquote><blockquote>Smaller teams make it easier to plan and sequence work. This has enabled us to move quickly on a number of projects.</blockquote><blockquote>There’s much more ownership, opportunities to lead, and flexibility.</blockquote><blockquote>It’s easier to feel proud of the work we are doing since there is more accountability and each person has a more direct impact on the successes of the team.</blockquote><p>But the switch to three-person teams forced us to make several changes to how we operated.</p><h4>We needed to learn to trust more easily</h4><p>We decided to move to three-person teams after one of our long-time engineers told me that I was holding us back by not giving new people leadership responsibility. Other engineers believed that only a small number of favored people would ever get to lead anything.</p><p>This engineer forced me to confront a bias that was holding me back. I leaned on trusting people who had repeatedly proven that they could deliver. But everyone on the team wanted to prove they could do something they hadn’t done before. I wouldn’t get my team’s best work without learning to trust more.</p><p>The larger team size was also a bad fit for the people we’d hired. We pride ourselves on hiring engineers who handle ambiguity well and who focus on solving problems rather than simply churning through tasks.</p><p>To become more trusting we redefined what leads were responsible for. Our new leads would only need to be able to coordinate the work of two other people, and not four or five. Our leads would not need to manage people. Their roles were also explicitly temporary. That made it easy for our leads to return to non-lead roles for any reason.</p><h4>We needed to train our leads</h4><p>When we added several leads we decided to train them in their new roles. John Lucas, one of our managers, developed an orientation for leads. He asked new leads to assess themselves along several dimensions including setting goals, recognizing problems, managing projects, managing risk, giving feedback, and creating psychological safety.</p><p>John’s orientation asked each lead to write a self assessment along these dimensions. He wrote his own assessment of each lead. They discussed the differences during their 1–1s. Our new leads were introspective and candid in their self-assessments. For example:</p><blockquote>I often feel hypocritical about feedback. I seek out and crave feedback from everyone around me, but often times have trouble giving high quality feedback back. Kim Scott would diagnose me with ruinous empathy. I care deeply about those I work with, but try to avoid confrontation and hurting others feelings. I do this despite knowing that it is best for everyone if I am direct and honest. This is the competency I want to improve in most.</blockquote><p>The best thing about the orientation is that it helped our new leads understand what new responsibilities they’d face day to day. When many of our experienced leads first stepped into leadership positions, they were surprised by how much they were suddenly responsible for. Talking openly about the challenges of leadership positions helped our leads know what to expect and to feel comfortable asking for help.</p><h4>The role of our managers changed</h4><p>Because our leads handled more responsibilities we needed fewer managers. Some managers moved into different roles. Those that remained had new responsibilities.</p><p>Our managers evolved into rovers. Each manager now had multiple three-person teams reporting to them and had a larger number of direct reports. Managers were no longer responsible for directly managing projects. They had to learn how to stay in touch with the detailed goings on of each of their three-person teams and to offer managerial or technical support when they were needed.</p><h4>Technical ownership was less stable</h4><p>Though we’d love to say that every three-person team fully owns small systems that are fully decoupled from those of other teams, there are plenty of shared systems today. Multiple three-person teams share on-call rotations. As a disciple of Amazon’s two-pizza teams, where each team exclusively owns a mandate and the systems that deliver the mandate, I was uncomfortable with the idea of shared ownership. I worried that our teams would have a diminished sense of ownership and wouldn’t invest in making their systems better.</p><p>In truth we’ve never been better at investing in technical improvements. I think the reason is that ownership is psychologically complex. Though sharing systems may create a diminished sense of ownership, the narrower and deeper mandates of the three-person teams hugely increased the sense of ownership that our engineers felt.</p><p>I owe credit to Kris Gale and Kellan Elliott-McCrea, who encouraged me to think of different ways of designing team responsibilities and ownership.</p><h4>Our engineers were less connected to each other’s work</h4><p>Though our team was happy with three-person teams, they started to report that they wanted to know more about what their colleagues were working on. Our teams would sometimes discover overlapping or complementary work. We haven’t totally solved this problem, but are experimenting with having each team send a very short (paragraph-length) summary of what they did each week.</p><h4>We created more work for product managers and designers</h4><p>In one sense our three-person teams weren’t really three people. Each team also had an associated product manager and a designer. They had to juggle more teams. Our product management team is well-staffed and could handle the larger number of teams. Increased output and increased parallelism sometimes put a strain on our design team.</p><p>Our experience with three-person teams has been positive. We’ve delivered faster, we’ve had more fun, and we’ve improved at developing talent. Scaling the number of three-person teams will be a challenge. We’ll have to identify and train more project leads, and we’ll have to scale engineering management, design, and product management to keep pace with the number of teams.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bcf599670c2a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/do-not-erase/moving-to-three-person-engineering-teams-bcf599670c2a">Moving to three-person engineering teams</a> was originally published in <a href="https://medium.com/do-not-erase">DO NOT ERASE.</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What’s the point of the Aggregate pattern?]]></title>
            <link>https://medium.com/@philsarin/whats-the-point-of-the-aggregate-pattern-741a3132da5c?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/741a3132da5c</guid>
            <category><![CDATA[design-patterns]]></category>
            <category><![CDATA[software-architecture]]></category>
            <category><![CDATA[domain-driven-design]]></category>
            <category><![CDATA[distributed-systems]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Mon, 10 Sep 2018 18:02:42 GMT</pubDate>
            <atom:updated>2018-09-10T18:02:42.109Z</atom:updated>
            <content:encoded><![CDATA[<p>Managed by Q helps people run offices. We have to be good at a ton of things, from filling administrative staffing openings to ensuring that office spaces are clean and well-maintained. We are currently evolving some of our core systems to better handle the variety of problems that we solve for our clients.</p><p>I’ve used this occasion to revisit <a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215"><em>Domain-Driven Design</em></a> (DDD) by Eric Evans and, in particular, the <a href="https://martinfowler.com/bliki/DDD_Aggregate.html">Aggregate</a> pattern. There are lots of descriptions online of what an Aggregate is and how to use one. But I’ve found it harder to explain <em>why</em> they should be used and to know where we should be using the pattern. I wrote this article to help myself get clear on what Aggregates are and when to use them. I hope it’s helpful for others as well.</p><h4>Defining DDD and Aggregates</h4><p>What is Domain-Driven Design? The main idea is for engineers and domain experts to agree on a “ubiquitous language” that describes the problem space in a way that makes sense to non-technical folks. That language should then dictate the design of software systems. When done right, the synergy between your problem domain and your software design makes it easier to build software that extends to fit future requirements.</p><p>An Aggregate is a specific software design pattern within DDD. <a href="https://www.amazon.com/NoSQL-Distilled-Emerging-Polyglot-Persistence/dp/0321826620/ref=sr_1_1?ie=UTF8&amp;qid=1536193490&amp;sr=8-1&amp;keywords=nosql+distilled"><em>NoSQL Distilled</em></a> by Pramod Sadalage and Martin Fowler defines an Aggregate as a “collection of related objects that we wish to treat as a unit.” In particular, an Aggregate is a tree of objects. Like all trees, it has a root and a boundary.</p><p>Because Aggregates have boundaries, it’s easy to distinguish between public and private elements of the Aggregate; the root is the only <em>public</em> member of the Aggregate. That is, it’s the only member that other Aggregates can directly reference. Only elements within an Aggregate can hold references to non-root (private) elements of that Aggregate. For example, consider an invoicing Aggregate, whose root is the invoice. Line items may be children of the invoice. No other Aggregate may hold a direct reference to an invoice line item. They may only refer to the invoice root itself.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*-L-NxvNikEh4AYEnre5HDg.png" /><figcaption>An invoice Aggregate</figcaption></figure><p>The boundary of an Aggregate also helps define a region of consistency. <em>Domain-Driven Design</em> states,</p><blockquote>Invariants, which are consistency rules that must be maintained whenever data changes, will involve relationships between members of the Aggregate. Any rule that spans Aggregates will not be expected to be up-to-date at all times. Through event processing, batch processing, or other update mechanisms, other dependencies can be resolved within some specified time. But the invariants applied within an Aggregate will be enforced with the completion of each transaction.</blockquote><p>So, for our invoicing example, the total of the invoice ($80 above) must always be consistent with the sum of the line item values ($40, $30, and $10). This invariant must always be satisfied; those values can’t even momentarily be inconsistent.</p><p>By contrast, state <em>between</em> Aggregates is eventually consistent. Let’s say that our invoice is generated when someone places an order. The Aggregate for the order may transition to the “invoiced” state immediately when the “buy” button is clicked. But the invoice Aggregate will be generated later — perhaps by milliseconds or perhaps by hours.</p><h4>An example: Social graph</h4><p>Let’s consider an example: a social graph of the form that Twitter uses. A person may <em>follow</em> another person. Following is a one way relationship. So if Jason follows Gloria, that does not mean that Gloria follows Jason. We shall also track the follower count and the followee count for each person.</p><p>There is a straightforward model for a social graph. We can have a Person object that has a follow() operation. In a relational database, we might implement this Person with two tables: Person and Follow. Each row of the Follow table would contain <em>from</em> and <em>to</em> columns, both of which are foreign key references to the Person table.</p><p>For example, let’s have Jason and Gloria start with no followers and no followees.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/511/1*9dmHHPDdrkOdMszFl3R_CQ.png" /><figcaption>Initial Stage: Jason and Gloria have no followers.</figcaption></figure><p>When Jason follows Gloria, we insert a row into the Follow table. Let’s assume for the sake of simplicity that follower and followee counts are dynamically calculated by querying the Follow table.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/494/1*H2Zz7aCiztLMR7-AmsTlcg.png" /><figcaption>Stage 1: Jason follows Gloria.</figcaption></figure><p>Note that, in this design, each Person is not an Aggregate. A Person doesn’t have a consistency boundary. One transaction modifies two Persons. In the example, we modified both Jason’s and Gloria’s Person Aggregates in one step. A Person isn’t the root of a tree. It’s a node in a graph.</p><p>But suppose we continue with this non-Aggregate design anyway and we want to cache the follower and followee counts so that we don’t have to continuously query the Follow table. We can end up with tricky locking behavior.</p><p>If we are pessimistically locking, we will need to lock both Jason’s and Gloria’s Person objects. To avoid deadlocks, we would perform three separate transactions:</p><ul><li>Insert a Follow row</li><li>Lock Jason and update his followee count</li><li>Lock Gloria and update her follower count</li></ul><p>If we are optimistically locking (possibly by using a strong <a href="https://www.postgresql.org/docs/9.1/static/transaction-iso.html">transaction isolation level</a>), we could do all three operations in one transaction. But performance may be poor for frequently followed Person objects.</p><h4>Social graph: Aggregate design</h4><p>We can model the social graph with Aggregates by separating followership from followeeship.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/426/1*lpp-uce3BwLgSDiSgVfS3A.png" /><figcaption>Social graph with an Aggregate design</figcaption></figure><p>Now, Jason’s and Gloria’s Person objects are both Aggregates. They contain private Follower and Followee objects that contain references to other Person objects. Think of these references simply as raw IDs and not as foreign key constraints. On a database level, we would no longer have a Follow table that simultaneously represents follower and followee relationships. Those relationships would be captured in separate tables.</p><p>But because there are two different aggregates, we need two different database transactions when Jason follows Gloria:</p><ol><li>We add a Followee, referencing Gloria, to Jason and update Jason’s followee count.</li><li>We add a Follower, referencing Jason, to Gloria and update Gloria’s follower count.</li></ol><p>So, Jason and Gloria will be eventually consistent with each other. To ensure that step 2 always happens after step 1, we would schedule step 2 during step 1’s transaction, likely by recording an event that we’d process asynchronously.</p><p>This pattern has clear locking behavior, regardless of whether we cache the follower and followee counts. We can lock Jason to add a followee and to update his followee count. We can lock Gloria to add a follower and to update her follower count. These two locks are completely independent of each other.</p><h4>So what’s the point?</h4><p>The Aggregate pattern imposes some constraints. Relational databases, programming languages, and popular web frameworks allow us to create arbitrary graphs of objects. But the Aggregate pattern requires that every object belongs to a tree and it limits each transaction to work on one Aggregate. Those requirements reduce flexibility and create work. Why would we agree to them?</p><p>The example above helps me think of a few reasons:</p><ul><li><strong>Aggregates make it easier to reason about large systems.</strong> In the absence of Aggregates, a design that starts as a relatively simple relational graph can evolve into a sprawl. Aggregates have inherent boundaries that prevent sprawls from forming. That makes it easier to define ownership over elements, to extract separate services, and to build database queries that are easy to understand.</li><li><strong>Rules for maintaining invariants are clear.</strong> There are no ad hoc transactions or bespoke locks. Transactions are scoped to Aggregates and we lock the root of the Aggregate.</li><li><strong>Scaling is easier.</strong> Should our social network explode in popularity, we might want to place Jason’s and Gloria’s Person objects on separate database shards to distribute load. This approach isn’t practically possible with the non-Aggregate design, because both Jason and Gloria share a common row of the Follow table. The Aggregate design makes sharding straightforward.</li></ul><p>These benefits may not be worthwhile for small systems and experimental projects. But as systems get larger, the scalability and clarity benefits of Aggregates justify the extra work.</p><h4>Further reading</h4><p>I hope this article helps clarify what Aggregates are and why they are used. I welcome pointers and links to other, better articles on this topic.</p><p>If you’re serious about finding ways to create ownership boundaries for service extraction, it may help to think at a higher level about the boundaries in your domain. I recommend reading about DDD’s strategic concepts, which include <a href="http://gorodinski.com/blog/2013/04/29/sub-domains-and-bounded-contexts-in-domain-driven-design-ddd/">subdomains and bounded contexts</a>. I find these concepts difficult to understand, and I might write a post on them one day.</p><p>I found these books especially useful in understanding Aggregates:</p><ul><li><a href="https://www.amazon.com/Domain-Driven-Design-Tackling-Complexity-Software/dp/0321125215/"><em>Domain-Driven Design</em></a></li><li><a href="https://www.amazon.com/Domain-Driven-Design-Distilled-Vaughn-Vernon/dp/0134434420/"><em>Domain-Driven Design Distilled</em></a></li><li><a href="https://www.amazon.com/NoSQL-Distilled-Emerging-Polyglot-Persistence/dp/0321826620/"><em>NoSQL Distilled</em></a></li><li><a href="https://vaughnvernon.co/?p=838">Effective Aggregate Design</a></li></ul><p>Thanks to John Chapin, Blake Dickstein, Matt Madurski, Travis Thieman, and David Van Couvering for reviewing drafts of this article and for helping me make it better.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=741a3132da5c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Making decisions faster]]></title>
            <link>https://medium.com/@philsarin/making-decisions-faster-e57e0a749535?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/e57e0a749535</guid>
            <category><![CDATA[decision-making]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Thu, 23 Aug 2018 18:12:34 GMT</pubDate>
            <atom:updated>2018-08-23T18:12:34.630Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Many product development organizations focus more on eliminating the waste of idle workers than on the waste of idle work. […] We are acutely aware that finding the bottlenecks in the flow of work and focusing our efforts on eliminating them is a far more economically sensible activity than trying to keep everyone 100% busy.</blockquote><p>— <a href="http://writersgarret.com/scrum-idle-work-and-idle-workers/">Kenny Rubin in <em>Essential Scrum</em></a></p><blockquote>Removing barriers to shipping is still the secret to velocity.</blockquote><p>— <a href="https://medium.com/@kellan/onward-510d88ae4a9e?token=p_6QGJhVgCKtgwa8">Kellan Elliott-McCrea</a></p><p>I hate slow decisions. I admit that part of my hatred is an aspect of my personality; I just like to move fast. The larger problem is that indecision is a productivity killer. Indecision causes idle work. And fixing it doesn’t require brilliance or 18-hour days. It simply requires making decisions.</p><p>I recently spoke with our team at Managed by Q about how to make decisions happen more quickly:</p><ul><li><strong>Ensure that roles are clear.</strong> It should be clear who needs to be involved in a decision, and it should also be clear what role they need to play. Can they veto the decision? Do they only need to be consulted? Or do they simply need to be informed. Decision frameworks like <a href="https://en.wikipedia.org/wiki/Responsibility_assignment_matrix#Key_responsibility_roles_(RACI_model)">RACI</a> have good guidance on how to define decision roles.</li><li><strong>“Get in sync” on the relevant information.</strong> In <a href="https://www.amazon.com/Principles-Life-Work-Ray-Dalio/dp/1501124021/ref=sr_1_1_sspa?ie=UTF8&amp;qid=1535036734&amp;sr=8-1-spons&amp;keywords=principles+ray+dalio&amp;psc=1"><em>Principles</em></a><em>, </em>Ray Dalio talks about the importance of “getting in sync” before making a decision. He defines getting in sync as trying “to attain alignment consciously, continually, and systematically.” Everyone involved in a decision should have the same understanding of facts and of each other’s positions. Getting in sync doesn’t require that everyone gets to <em>agreement</em> — but they need to understand their points of disagreement.</li><li><strong>If you’re responsible for the decision, make it before the </strong><a href="https://blog.codinghorror.com/the-last-responsible-moment/"><strong>last responsible moment</strong></a><strong>. </strong>There’s a tendency to delay decisions until you’re fully confident. But, as most important decisions are reversible, that’s too generally too long to wait. <a href="http://integratedleader.com/articles/40-70rule.pdf">Colin Powell’s 40–70 rule</a> helps here. If you have less than 40% of the information you need, you are bound to make a bad decision. If you have more than 70%, you’ve probably waited too long.</li><li><strong>If you’re not responsible for the decision, make sure the right person knows they are responsible.</strong> It helps to ask, “Who owns the decision here?”</li><li><strong>Don’t fear escalation.</strong> People fear escalation — the process of appealing a decision with someone’s boss — because it can seem like a vote of no confidence. It’s actually just a tool to make a decision happen faster. I can accelerate controversial decisions by making a call and inviting someone who disagrees with me to escalate to my boss. It’s a faster route than trying to please everyone, which rarely ever works.</li></ul><p>Making decisions quickly is one of the cheapest productivity tricks I know. It requires getting comfortable with disagreement, but it’s a great way to boost a team’s morale and to improve output.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e57e0a749535" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Abandoning fake deadlines]]></title>
            <link>https://medium.com/garbage-collection/abandoning-fake-deadlines-4d535b9aec3b?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/4d535b9aec3b</guid>
            <category><![CDATA[kanban]]></category>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[deadlines]]></category>
            <category><![CDATA[agile]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Fri, 24 Feb 2017 20:57:27 GMT</pubDate>
            <atom:updated>2017-02-24T20:57:27.168Z</atom:updated>
            <content:encoded><![CDATA[<p>Deadlines happen in real life, and they work. Christmas happens on December 25 and virtually everyone who celebrates buys their presents on time. Taxes are due on April 15 and few people ask for an extension. Deadlines create urgency and some stress, and they motivate action.</p><p>In product development, we often create <em>fake</em> deadlines to impart the same urgency. I call these deadlines fake when missing the deadline has no actual consequence to the business. The deadline exists only so that we <em>pretend</em> it’s real and demonstrate the same stress and urgency that we’d use for a real deadline. Many managers are ignorant to the downside of this tactic.</p><p>The fundamental problem with fake deadlines is that they mislead teams about what actually matters. At Managed by Q, we hire smart, ambitious people. I believe the way to maximize the impact of smart people is by helping them understand what’s important. Managing a team towards a goal that’s not important (or that isn’t the most important thing) will lead to suboptimal results for both the team and the company.</p><h4>Here are some ways in which fake deadlines lead to bad results:</h4><ul><li><strong>They distort priority. </strong>Once a team commits to a deadline it’s hard to un-commit. When they learn of more important work, their incentive is to ignore it in favor of meeting the deadline even when that’s the wrong choice.</li><li><strong>They undervalue quality. </strong>I’ve often seen teams, especially inexperienced ones, sacrifice quality to hit a deadline, either by skimping on testing or by pushing back on important tweaks requested by designers and product managers. It’s often smarter to miss a fake deadline than to cut corners.</li><li><strong>They waste time. </strong>When people know they’ll be judged on hitting deadlines, they’ll invest extra time in making and defending estimates. Spending less time on rougher estimates is usually the right decision.</li><li><strong>They creep scope. </strong>Deadlines set an end time, and people tend to make their work last that long. It’s better to identify the fastest way to deliver value, even if it deviates from the initial plan and deadlines.</li></ul><p>Product development teams commonly attempt to address these issues by adopting processes like <a href="https://www.scrumalliance.org/why-scrum">Scrum</a>. Scrum promises to reduce deadline pressure by continuously reprioritizing on a fixed cadence, usually weekly. I’ve found, though, that Scrum’s timeboxed sprints function like fake deadlines. Scrum positions missing a timebox by a day as <em>slipping to the next sprint</em>, a practice that feels like a failure. Though Scrum tends to mitigate scope creep, I often see Scrum teams waste time on estimates, distort priority, and skimp on quality.</p><p>When I joined Q, we replaced Scrum with a deadline-free <a href="https://leankit.com/learn/kanban/what-is-kanban/">Kanban</a>-like process and had initial success, <a href="https://medium.com/garbage-collection/getting-out-of-the-way-cb15fa62407d#.wnw957274">which I wrote about last year</a>. We also had a couple of projects where our urgency lagged or we lapsed into a deadline mentality. Though these experiences, we’ve learned a few tricks for executing well without deadlines.</p><h4>How we produce good results without deadlines:</h4><ul><li><strong>Invite scrutiny.</strong> To an outsider, a deadline-free process can seem unaccountable. We had to make an extra effort to encourage critical questions from the people and teams who depended on us. Though we don’t have deadlines, we found it important to give an idea of when we’ll do things — or we rob others of the ability to challenge our priorities and to suggest new ones. We send a weekly update to the company and review it live with key stakeholders every week. We position our date estimates as projections and not deadlines so that occasional slips don’t cause alarm.</li><li><strong>Defer external commitment.</strong> Despite our efforts to avoid deadlines, we found that we often set deadline-like expectations if we committed to goals too early. Assigning a date projection to a project implies that it <em>will</em> happen and reduces our ability to shuffle our priorities. We even stopped publishing quarterly OKRs for product development as we found that they implied a deadline. We instead published a vision document that explained our quarterly goals in qualitative terms.</li><li><strong>Build a culture of high internal commitment. </strong>In an environment with no deadlines or hard external commitments, our teams need to strive to deliver quickly. Our teams push themselves to hit dates, but they position these dates as challenges and not deadlines. I’ll hear teams ask at daily stand-up meeting, “Can we ship by Thursday?” A culture of high, visible internal commitment creates trust that’s necessary when a team decides to take a “smart” date slip to improve quality or to work on emerging priorities.</li><li><strong>Celebrate your real wins.</strong> At a recent all-hands meeting, one of our teams recently announced a 100x improvement in an important customer experience metric. It was a big win and a huge surprise, given their goal of a 2x improvement. The company was thrilled. Nobody noticed or cared that the team had slipped their initial estimates by a few days. Celebrating results helps build trust with others and makes it easier to defer external commitments. Celebrating results also reinforces result-seeking behavior.</li></ul><p>The big idea here is a simple one. We hire great people who want to make an impact. The best way to get great people to deliver great things is to help them understand what’s important. We shouldn’t try to manage by trickery — asking them to hit fake deadlines, rewarding them when they do, reprimanding when they don’t, and hoping good results will appear as a side-effect. People make bad tradeoffs under those circumstances. We want to set them up to make good tradeoffs.</p><p>Moving away from fake deadlines requires a shift in perspective. To make it work we focus on building trust in all directions. We focus on transparency, agility, commitment, and celebration — and believe that they set up talented people to succeed.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4d535b9aec3b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/garbage-collection/abandoning-fake-deadlines-4d535b9aec3b">Abandoning fake deadlines</a> was originally published in <a href="https://medium.com/garbage-collection">Garbage Collection</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Managed by Q’s engineering interview process]]></title>
            <link>https://medium.com/garbage-collection/managed-by-qs-engineering-interview-process-3806377813bf?source=rss-e1d49e54952d------2</link>
            <guid isPermaLink="false">https://medium.com/p/3806377813bf</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[coding]]></category>
            <dc:creator><![CDATA[Phil Sarin]]></dc:creator>
            <pubDate>Tue, 23 Aug 2016 15:42:26 GMT</pubDate>
            <atom:updated>2016-08-23T15:42:26.278Z</atom:updated>
            <content:encoded><![CDATA[<p>Interview processes are in some ways like engineering problems. Both operate in imperfect environments where failures happen, and our job is to design a system that can withstand those failures. There are different variables that we can optimize, and there are tradeoffs for optimizing each.</p><p>It’s easy to get dogmatic about this stuff. <em>(You must ask about pointers and recursion. Whiteboard interviews are evil.)</em> We aren’t. We’ve optimized for what we think leads to success at Q.</p><h3>What we’re looking for</h3><p><strong>Non-technical interviews</strong></p><p>We’re excited about <a href="http://www.nytimes.com/2016/02/28/magazine/managed-by-qs-good-jobs-gamble.html">using technology to create good jobs</a>. We do that by making it easy to run an office, by handling the logistical details that distract our customers from running their businesses. Our problems aren’t just virtual. They’re physical and tangible, and that excites us.</p><p>We hire engineers who</p><ul><li>Like what we’re doing</li><li>Earn trust and operate with minimal management</li><li>Get things done under ambiguous circumstances</li><li>Exhibit humility, a love of learning, and empathy</li></ul><p><strong>Technical design interviews</strong></p><p>In our phone-based and on-site interviews, we look for the ability to think like an engineer. The right candidates can have a fun, productive conversation on a deep technical topic. They can also reason about the tradeoffs that are inherent in any hard problems.</p><p>In general, we look more for the <em>why </em>more than the <em>what</em>. A candidate doesn’t need to know about every trendy database or every last MVC framework to do well. That said, there are some roles for which specific knowledge matters a lot.</p><p><strong>Coding interviews</strong></p><p>We use our coding interviews to assess both whether candidates can solve hard problems and whether they can express their ideas in code.</p><p>Though we do an online coding interview before candidates visit our office, we prefer to do our onsite interviews on whiteboards. In comparison with computer-based interviews, whiteboard interviews allow us to cover harder questions in less time, because they spare us from waiting through run/test/debug cycles.</p><p>Whiteboard interviews have flaws, as do all coding interviews. Here’s what we do to address them:</p><ul><li>Give information on how to prepare for our interviews (this post)</li><li>Require multiple coding interviews. We tend to favor a candidate’s <em>best</em> performance when we evaluate them.</li><li>Avoid questions that require tricks or intuitive leaps</li><li>Forgive unimportant mistakes (e.g., minor syntax errors)</li><li>Coach candidates when they make mistakes in interview tactics (e.g., rushing to code without understanding a problem)</li></ul><h3>Our interview lineup</h3><p><strong>Pre-screens</strong></p><ol><li>A conversation with a recruiter</li><li>A non-coding technical interview with an engineer.</li><li>An online coding screen</li></ol><p><strong>On site (day 1)</strong></p><ol><li>Product demo</li><li>Technical design interview</li><li>Two whiteboard coding interviews</li></ol><p><strong>On site (day 2)</strong></p><ol><li>(For experienced candidates) Detailed career history</li><li>Behavioral interviews</li></ol><h3>What candidates need to know</h3><p>We expect candidates to be comfortable with the following technical concepts:</p><ul><li>Usage of basic data structures (trees, graphs, arrays, lists, hash tables/dictionaries)</li><li>Recursion</li><li>The time/space complexity of fundamental algorithms (linear and binary search, sorting)</li><li>The basic structure of HTTP, including requests, responses, headers vs body, and the most common return codes. (We won’t ask people to recall what an HTTP 422 is on the spot.)</li><li>Usage of HTTP-based APIs and JSON</li><li>The Single Responsibility Principle</li><li>(For candidates who work mostly on the backend) Databases (SQL or not — doesn’t matter)</li><li>(For candidates who work mostly on the frontend) At least one pattern of UI application architecture. E.g., MV* or Flux.</li></ul><p><em>A computer science degree is not a requirement for joining our engineering team.</em> Some of the strongest engineers in our field do not have computer science degrees. But we find that we can ask more challenging questions if we presume that candidates know a couple of basic concepts that are taught in computer science programs.</p><h3>How we make decisions</h3><p>We define scorecards before we interview candidates for a position, and we aim to apply them consistently to candidates.</p><p>This may seem counterintuitive. A lot of people prefer to rely on gut instinct when they assess candidates. We were swayed by the arguments in <a href="https://www.amazon.com/Thinking-Fast-Slow-Daniel-Kahneman/dp/0374533555"><em>Thinking, Fast and Slow</em></a>, which cites decades of research arguing that structured, consistent interviews are more predictive of on-the-job performance than interviews based on gut feeling.</p><p>Based on the information we’ve gathered from our interviews, we then decide whether or not to make an offer.</p><h3>Parting thoughts</h3><p>We have a good track record, but we aren’t perfect. We know that we will make some mistakes. We also know that some people we reject will do outstanding work in other environments. We hope, though, that all of our candidates will believe that we treated them as we’d want to be treated ourselves.</p><h3>Acknowledgements</h3><p>We borrowed and adapted ideas from several sources, including</p><ul><li><a href="https://www.amazon.com/Thinking-Fast-Slow-Daniel-Kahneman/dp/0374533555"><em>Thinking, Fast and Slow</em></a></li><li><a href="https://www.amazon.com/Who-Geoff-Smart/dp/0345504194"><em>Who: The A Method for Hiring</em></a></li><li><a href="https://www.creativelive.com/courses/creating-an-effective-developer-interview-gayle-laakmann-mcdowell">An online interviewing class</a> with Gayle Laakmann McDowell</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3806377813bf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/garbage-collection/managed-by-qs-engineering-interview-process-3806377813bf">Managed by Q’s engineering interview process</a> was originally published in <a href="https://medium.com/garbage-collection">Garbage Collection</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>