<?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 Oliver Azevedo Barnes on Medium]]></title>
        <description><![CDATA[Stories by Oliver Azevedo Barnes on Medium]]></description>
        <link>https://medium.com/@oliver_azevedo_barnes?source=rss-f847cf33e8d7------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*TpPQSTJ4kOw05RFCtlvbAw.jpeg</url>
            <title>Stories by Oliver Azevedo Barnes on Medium</title>
            <link>https://medium.com/@oliver_azevedo_barnes?source=rss-f847cf33e8d7------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 11:35:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@oliver_azevedo_barnes/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[Learning Rust for Web APIs]]></title>
            <link>https://medium.com/@oliver_azevedo_barnes/learning-rust-for-web-apis-2ff388ae53a6?source=rss-f847cf33e8d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ff388ae53a6</guid>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[learning]]></category>
            <dc:creator><![CDATA[Oliver Azevedo Barnes]]></dc:creator>
            <pubDate>Fri, 16 Feb 2024 13:14:05 GMT</pubDate>
            <atom:updated>2024-02-19T19:22:15.423Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YQ12VWIJA6b08MwGa8Ab7Q.png" /></figure><p>I had been hearing about Rust for years. Ruby greats like Yehuda Katz and Steve Klabnik were involved in it. People raved about the care devoted to documentation and to the friendly compiler, about the strong typing, the robustness, the lack of runtime errors, each reminding me of my pleasant, brief experience with Elm. And they all raved about the speed, of course.</p><p>GC-less memory management and Rust-as-C++-replacement didn’t sound as appealing, though, I’ll admit. At least initially. Too low level for comfort.</p><p>Rust seemed like something I’d respect from afar, watching it spread like wildfire in systems and blockchain development, consistently voted most-loved language while at it, and I’d just carry on with good old comfy Ruby, which I still love, and expand on Elixir as new web api projects, my bread and butter, came up.</p><p><strong>The case for the web</strong></p><p>Then <a href="https://mainmatter.com/">Mainmatter</a>, a consultancy I frequently work with, well known in Ember-land and long delivering Ruby and Elixir services, came along and <a href="https://mainmatter.com/blog/2023/08/14/the-case-for-rust-on-the-web/">made a big bet on Rust</a> for web backends. With a convincing pitch.</p><p>It’s not about replacing Ruby/Elixir/Python/JS/&lt;your fave web lang&gt; when quickly iterating on new web apps, while early startups discover what their product is about. Not yet, at least. Not for a while, perhaps.</p><p>But it is about rewriting certain services with less churn, at more mature companies, to be super-performant and reliable. Save big in infrastructure and bug fixing costs. And even lower your carbon footprint in the process.</p><p>All the while keeping things very maintainable: Rust’s syntax is expressive, and its typing system allows for elegant abstractions and composition.</p><p>That’ll be a gateway drug for your team. After these initial rewrites, they’ll be confident to expand into new apps and services. Other team members will want to jump in. Different stakeholders will see the benefits and will progressively open up to it. Eventually they’ll invest in adopting it for their main development flow. Apparently this is already, silently, happening <a href="https://mainmatter.com/cases/aleph-alpha/">in machine learning pipelines</a>.</p><p>Meanwhile, Rust’s web ecosystem is rapidly maturing, making it easier for new devs and companies to adopt it for their web work. A virtuous cycle will ensue.</p><p><strong>Ruby (and even Elixir) pains</strong></p><p>In parallel to MM’s bet, I had been dealing with lower-level Ruby issues getting more and more into performance tuning. Years of doing archeology work in legacy Rails apps inherited from different waves of developers accumulated. And like I said earlier, I still love Ruby. It’s been making progress in concurrency and performance with things like Ractors, yjit and jemalloc. There’s even attempts at adding typing to it.</p><p>But natively strongly typed languages, with robust concurrency out of the box, became increasingly attractive.</p><p>Even in Elixir projects, with its superb concurrency and its functional-ness making things more predictable, strong typing was missed. A CTO at a fintech client, previously all-in into Elixir, was indeed craving it. His team started migrating towards to Rust.</p><p>Finally I decided to take a closer look.</p><p><strong>Getting started</strong></p><p>I went the opposite direction of when I learned Ruby: back then I learned Rails (coming from PHP), and then, slowly, Ruby. Painful process. I later realized I should’ve invested time upfront into learning Ruby more thoroughly first. Duh.</p><p>So I read The Rust Book (<a href="https://rust-book.cs.brown.edu/experiment-intro.html">the experimental version</a>). The introduction to the ownership model is very well-written, and the basic ownership model seemed pretty intuitive, it turns out. Generics and traits as well. Not so scary. In the happy path, at least: at times of course it does get hairy, specially when lifetimes are involved. But it grew on me. I worked through <a href="https://github.com/rust-lang/rustlings">Rustlings</a>, a set of exercises kinda like <a href="https://exercism.org/">Exercism</a>. And I started following the <a href="https://www.reddit.com/r/rust/">Rust reddit</a>.</p><p>In parallel I started reading <a href="https://www.zero2prod.com/index.html?country=Portugal&amp;discount_code=VAT20">Zero2Prod</a> by <a href="https://www.lpalmieri.com/">Luca Palmieri</a>, Rust extraordinaire who’s now working at Mainmatter and is spearheading the Rust front there. He writes well too, and demystifies using Rust for the web, with good practices (tests, CI builds, telemetry) included from the beginning. The book brings up async Rust, something the Rust Book doesn’t discuss. Which led me to the <a href="https://rust-lang.github.io/async-book/01_getting_started/01_chapter.html">Async Rust Book</a>.</p><p>I’d be lying if I said I read both books cover to cover like I did the Rust Book. I’ve been reading fragments of both in an undisciplined way, as I feel the need. But I recommend checking both of them out.</p><p>It just so happens Luca is also developing <a href="https://pavex.dev/">Pavex</a>, a web framework in Rust meant to be more full-featured and batteries-included than existing alternatives. He’s recently started <a href="https://www.lpalmieri.com/posts/pavex-is-in-closed-beta/">a closed beta</a> that’s open to anyone with basic knowledge of Rust. I joined, and it’s a pretty interesting experience watching the early beginnings of a new web framework.</p><p>I’ll be writing about it in more detail in future posts.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ff388ae53a6" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Setting up a Small Local K8s Cluster for Development]]></title>
            <link>https://medium.com/@oliver_azevedo_barnes/setting-up-a-small-local-k8s-cluster-for-development-cb1c99c6320d?source=rss-f847cf33e8d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/cb1c99c6320d</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[prometheus]]></category>
            <category><![CDATA[grafana]]></category>
            <dc:creator><![CDATA[Oliver Azevedo Barnes]]></dc:creator>
            <pubDate>Wed, 06 Nov 2019 19:38:11 GMT</pubDate>
            <atom:updated>2019-11-06T19:42:08.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>Running a Small Local K8s Cluster for Development</h3><p>Steps to run <a href="https://github.com/oliverbarnes/liquid-voting-service">liquid-voting-service</a> on a local single-node Kubernetes cluster with Prometheus monitoring.</p><p>You should have <a href="https://www.docker.com/products/docker-desktop">Docker Desktop</a> running, and you’ll need to <a href="https://helm.sh/docs/using_helm/#initialize-helm-and-install-tiller">install Helm</a> for some of them.</p><p>First, clone the project repo and cd into it:</p><pre>git clone <a href="/service/mailto:git@github.com">git@github.com</a>:oliverbarnes/liquid-voting-service.git<br>cd liquid-voting-service</pre><p>Install the <a href="https://github.com/kubernetes/ingress-nginx">ingress-nginx controller</a>:</p><pre>helm install stable/nginx-ingress \<br> — set controller.metrics.enabled=true,controller.metrics.serviceMonitor.enabled=true,controller.stats.enabled=true</pre><p>Create configuration <a href="https://kubernetes.io/docs/concepts/configuration/secret/">secrets</a> for the Postgres database:</p><pre>kubectl create secret generic liquid-voting-postgres \<br> — from-literal=postgres-username=postgres \<br> — from-literal=postgres-password=postgres \<br> — from-literal=postgres-dbname=liquid_voting_dev \<br> — from-literal=postgres-host=localhost \<br> — from-literal=postgres-pool-size=10</pre><p>Then apply the app’s manifest files:</p><pre>kubectl apply -f k8s/ingress.yaml<br>kubectl apply -f k8s/database-persistent-volume-claim.yaml<br>kubectl apply -f k8s/database-service.yaml<br>kubectl apply -f k8s/database-deployment.yaml<br>kubectl apply -f k8s/liquid-voting-service.yaml<br>kubectl apply -f k8s/liquid-voting-deployment.yaml</pre><p>If all goes well, you should have seen the following output:</p><pre>ingress.extensions/liquid-voting-ingress created<br>persistentvolumeclaim/postgres-pvc created<br>service/db created<br>deployment.extensions/db created<br>service/liquid-voting-service created<br>deployment.apps/liquid-voting-deployment created</pre><p>These will have you set up a main API <a href="https://kubernetes.io/docs/concepts/services-networking/service/#service-resource">service</a> with 3 pods <a href="https://kubernetes.io/docs/concepts/workloads/controllers/deployment/">deployed</a>, exposed through an <a href="https://kubernetes.io/docs/concepts/services-networking/ingress/#what-is-ingress">ingress,</a> backed by a Postgres database service using a <a href="https://kubernetes.io/docs/concepts/storage/persistent-volumes">persistent volume claim</a>. Using <a href="https://kubernetes.io/docs/reference/kubectl/overview/">kubectl</a> to inspect them, you should see something similar to the following output:</p><pre>➜  liquid-voting-service git:(master) kubectl get ingress<br>NAME                    HOSTS   ADDRESS   PORTS   AGE<br>liquid-voting-ingress   *                 80      81s<br>➜  liquid-voting-service git:(master) kubectl get services<br>NAME                    TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)    AGE<br>db                      ClusterIP   10.101.108.253   &lt;none&gt;        5432/TCP   88s<br>kubernetes              ClusterIP   10.96.0.1        &lt;none&gt;        443/TCP    4h5m<br>liquid-voting-service   ClusterIP   10.110.85.61     &lt;none&gt;        4000/TCP   87s<br>➜  liquid-voting-service git:(master) kubectl get pvc<br>NAME           STATUS   VOLUME                                     CAPACITY   ACCESS MODES   STORAGECLASS   AGE<br>postgres-pvc   Bound    pvc-b2e084a8-5b03-45dc-a998-b73d626ac6f0   1Gi        RWO            hostpath       95s<br>➜  liquid-voting-service git:(master) kubectl get pods<br>NAME                                        READY   STATUS                       RESTARTS   AGE<br>db-75fc47475c-x2rtr                         1/1     Running   0          119s<br>liquid-voting-deployment-86c87747f6-hxt4j   1/1     Running   0          119s<br>liquid-voting-deployment-86c87747f6-s9zbs   1/1     Running   0          119s<br>liquid-voting-deployment-86c87747f6-zk4hf   1/1     Running   0          119s</pre><p>Lastly, run the Elixir app’s migrations from within the app deployment:</p><pre>kubectl get pods<br>kubectl exec -ti liquid-voting-deployment-pod \<br> — container liquid-voting \<br> — /opt/app/_build/prod/rel/liquid_voting/bin/liquid_voting \<br> eval “LiquidVoting.Release.migrate”</pre><p>All going well, you should be able to see the app’s <a href="https://github.com/graphql/graphiql">GraphQL IDE</a> by pointing your browser to <a href="http://localhost:4000/graphiql">localhost:4000/graphiql</a>.</p><h3>Setting up monitoring (Prometheus and Grafana):</h3><p>You might have noticed the ingress controller install command back in the beginning also sets a few options:</p><pre>controller.metrics.enabled=true,<br>controller.metrics.serviceMonitor.enabled=true,<br>controller.stats.enabled=true</pre><p>These prep the controller to have metrics scraped by Prometheus.</p><p>Let’s then install <a href="https://github.com/helm/charts/blob/master/stable/prometheus-operator/README.md">prometheus-operator</a>, which will get you going with both <a href="https://prometheus.io/">Prometheus</a> and <a href="https://grafana.com/">Grafana</a> and setup a k8s <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/operator/">operator</a> to watch the above:</p><pre>helm install stable/prometheus-operator</pre><p>The metrics won’t be scraped right away. In order to get Prometheus to see them, there are a couple of hoops to jump through.</p><p>You’ll need to make the ingress’ <a href="https://github.com/coreos/prometheus-operator/blob/master/Documentation/design.md#servicemonitor">servicemonitor</a> (a k8s <a href="https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/">custom resource</a> introduced by the operator) release label match the one Prometheus expects. A little hacky and manual, but no way around it as far as I know and after extensive googling (see <a href="https://github.com/coreos/prometheus-operator/issues/2119#issuecomment-439620190">this issue on their repo</a>):</p><p>Take a look at your Prometheus instance’s <em>matchLabel.release</em> config:</p><pre>kubectl get prometheus prometheus-instance -o yaml</pre><p>Then open your ingress servicemonitor and edit its <em>metadata.labels.release</em> field to match it:</p><pre>kubectl get servicemonitors<br>KUBE_EDITOR=your-favorite-editor kubectl edit servicemonitor ingress-controller</pre><p>That’s it, after this Prometheus should be scraping the metrics. You can check that by looking at <a href="http://localhost:9090/graph">localhost:9090/graph</a>.</p><p>Let’s now expose the Grafana dashboard:</p><pre>export POD_NAME=$(kubectl get pods -l “app=grafana” -o jsonpath=”{.items[0].metadata.name}”)<br>kubectl port-forward $POD_NAME 3000</pre><p>Open <a href="http://localhost:3000/">localhost:3000</a> and you’ll see a login page.</p><p>The password secret was generated during the install. To get it, run:</p><pre>kubectl get secret my-release-grafana \<br> -o jsonpath=”{.data.admin-password}” \<br> | base64 — decode ; echo</pre><p>The login user is <em>admin</em>. Upon logging in, you should see Grafana main screen and a few pre-installed dashboards.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cb1c99c6320d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Liquid Voting as a Service]]></title>
            <link>https://medium.com/@oliver_azevedo_barnes/liquid-voting-as-a-service-c6e17b81ac1b?source=rss-f847cf33e8d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/c6e17b81ac1b</guid>
            <category><![CDATA[liquid-democracy]]></category>
            <category><![CDATA[projects]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[civictech]]></category>
            <category><![CDATA[open-source]]></category>
            <dc:creator><![CDATA[Oliver Azevedo Barnes]]></dc:creator>
            <pubDate>Sat, 12 Oct 2019 16:02:27 GMT</pubDate>
            <atom:updated>2020-05-24T10:40:56.027Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*D5Sr8ulQAtUasuI9" /><figcaption>Photo by <a href="https://unsplash.com/@ajaegers?utm_source=medium&amp;utm_medium=referral">Arnaud Jaegers</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Lately I have been working on a a <a href="https://liquidvoting.io/">liquid voting api and micro-service</a>. It’s in its early beginnings, but enough is done to make it worth writing up about, and hopefully start getting some feedback on.</p><h3>What is liquid voting?</h3><p>It is voting with the option of delegating one’s vote instead. A person chosen as a delegate can then vote for the two of them (her vote now has a weight of 2), or delegate both their votes to a third person who will then have a voting weight of 3, and so on. Anybody can override a delegation and vote directly at any time. This creates a changing, fluid chain of representivity, hence the name “liquid”. Which is a more buzzy alternative to “delegative”.</p><p>It’s a key aspect of <a href="https://en.wikipedia.org/wiki/Liquid_democracy">liquid democracy</a>, a form of democratic proposal and decision making falling in between direct and representative democracies. Not meant to replace either one, but to complement them.</p><p>The benefits are more engagement and trust from participants. Even if you don’t have the knowledge, inclination or simply the time to get involved in a given issue, you can still have your voice heard through trusted delegates. People in your immediate circle, or well known specialists or activists you respect. And you have different delegates for different topics. If that trust is breached, overriding through direct voting or by delegating to another person ensures you’re not stuck with a bad representative.</p><h3>The elevator pitch</h3><p>To make it easy to harness liquid democracy on any online platform being used for proposal making. It aims to be an easily pluggable component focusing solely on voting and voting delegation, and on maintaining a delegation graph. Either to be installed as an internal service within a platform’s infrastructure (for free — it’s open source), or connected-to through a hosted version, free for small civic organizations, and priced on a freemium model for larger orgs and businesses interested in democratic governance. Following Wordpress’s model.</p><h3>The basic premises, to be tested</h3><p>Online democratic platforms are inherently complex and hard to get right. They have to juggle a few different and difficult domains: identity management, online debate and moderation (or not), content management and versioning, and of course voting and delegation. In order to get any adoption, all of this needs to be tackled with beautiful and easy to use interfaces. It’s a lot.</p><p>Today, if anybody wants to benefit from online liquid democracy in their organization, they have to install or sign up for a large and hard to use system whose developers are trying, valiantly, to deliver with all of the above included. They just might manage to do so eventually (and I hope they do), but it’s a ways off.</p><p>Meanwhile, and even when these platforms get to a mature and user-friendly state, one ought to access different functionalities piecemeal if they want, and delegated voting is a strong candidate for this. It’d be nice to just drop in a widget talking to a specialized API to get liquid voting going with whatever proposal making tool your org is using — even if that’s a blog, or pull/merge requests. Granted, for more sensitive content where fraud might be a risk, this integration will be more involved, but many times integrating with an organization’s existing identity management will be enough. It’d also nice for other backend systems to have a readily available API, as a service or as a free component, and let developers focus on other core functionalities.</p><p>Commoditized components implementing parts of the above-mentioned domains can make the road to ubiquitous and accessible democratic platforms easier, lowering the bar for new projects, and lightening the load juggled by current platforms. They can make trying out different implementations and combinations easier, speeding up experimentation.</p><p>With that in mind, <a href="https://github.com/oliverbarnes/liquid-voting-service">liquid-voting-service</a> comes dockerized from the get-go, so it can easily be wired in.</p><p>Down the line I would also like to get this integrated with a blockchain, possibly <a href="https://blockstack.org/">Blockstack</a>’s initially.</p><p>And that’s it, in a nutshell.</p><p>What do you think of the idea and the premises for the project? Please let me know in the comments.</p><h3>Contributors Welcome</h3><p>More than welcome :) if you’re civic-minded, interested in Liquid Democracy, or simply would like to play with Elixir/Phoenix, GraphQL, Docker and Kubernetes, please contact me on <a href="https://github.com/oliverbarnes">Github</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c6e17b81ac1b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Filling the Gaps: Assorted Dev Readings (Part II)]]></title>
            <link>https://medium.com/@oliver_azevedo_barnes/filling-the-gaps-assorted-dev-readings-part-ii-92a61c36388a?source=rss-f847cf33e8d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/92a61c36388a</guid>
            <category><![CDATA[scrum]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[books]]></category>
            <category><![CDATA[continuous-delivery]]></category>
            <dc:creator><![CDATA[Oliver Azevedo Barnes]]></dc:creator>
            <pubDate>Fri, 11 Oct 2019 15:42:12 GMT</pubDate>
            <atom:updated>2019-10-12T14:33:51.556Z</atom:updated>
            <content:encoded><![CDATA[<p>This past year I’ve <a href="https://medium.com/@oliver_azevedo_barnes/assorted-dev-readings-5f69bb9382bc">had the opportunity to do some good reading</a>, in part to fill knowledge gaps and prepare for new types of projects, and also just to satisfy my curiosity. On my last post I shared some notes about books I read on <a href="https://pragprog.com/book/bksqla/sql-antipatterns">SQL Antipatterns</a>, <a href="https://www.amazon.com/gp/product/1491954388">Bitcoin</a> and <a href="https://pragprog.com/book/jgotp/designing-elixir-systems-with-otp">Elixir/OTP</a>. As a web application and API developer for several years, SQL is part of my day-to-day work, and naturally the more I know about it, the better. Reading on Bitcoin development was out of sheer curiosity.</p><p>On this second post I talk about books I read either in full or partially as part of strengthening my knowledge of DevOps, microservices and digital transformation. These are strongly related with each other: most projects I’ve worked in for the past few years were in the middle of, one way or another, getting developers more involved with infrastructure and deployment, decomposing monolith or coarse-grained service-oriented apps into dockerized microservices, and changing their development processes, all in efforts to become more agile and deliver improvements to products more quickly. It’s clear these days a software engineer has to be knowledgeable on all three. A <a href="https://en.wikipedia.org/wiki/Kaizen">Kaizen</a> ninja, in other words (not that I am one — but I’m working on it). These books help with that:</p><ul><li><a href="https://www.amazon.com/Site-Reliability-Engineering-Production-Systems/dp/149192912X">Site Reliability Engineering</a></li><li><a href="https://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912">Continuous Delivery</a></li><li><a href="https://www.amazon.com/Succeeding-Agile-Software-Development-Using/dp/0321579364">Succeeding with Agile</a></li><li><a href="https://www.amazon.com/Docker-Up-Running-Karl-Matthias/dp/1491917571">Docker: Up &amp; Running</a></li><li><a href="https://www.manning.com/books/microservices-in-action">Microservices in Action</a></li></ul><p>On to the notes:</p><p><a href="https://landing.google.com/sre/sre-book/toc/index.html">Site Reliability Engineering: How Google Runs Production Systems</a>, by Betsy Beyer, Chris Jones, Jennifer Petoff and Niall Richard Murphy. (There’s a <a href="https://www.amazon.com/Site-Reliability-Engineering-Production-Systems/dp/149192912X">print version</a> if you prefer not to read online)</p><p>Read cover-to-cover on the run up to a digital transformation project. The book is a compilation of essays by different Google engineers, going over the history and implementation of Google’s <a href="https://landing.google.com/sre/#sre">SRE</a> practice, what you could call their take on DevOps, developed in parallel but also in dialog with the latter. Their sequel book,<a href="https://landing.google.com/sre/workbook/toc/"> The Site Reliability Workbook</a>, also available online, has a <a href="https://landing.google.com/sre/workbook/chapters/how-sre-relates/">chapter describing the relationship between SRE and DevOps</a>. My understanding is that Google’s approach is more structured and prescribed, what works for them, whereas DevOps is a set of recommendations that can be implemented in different ways.</p><p>It proposes approaching operations as an engineering problem, continuously automating wherever possible, making apps and services fully observable. And approaching development planning using the data incoming from monitoring and logs, watching a selection of indicators (such as response error rate, or latency) and setting objectives (say, a response time of &lt; 300ms) based on them. Agreements between the service team and the customers are then established based on the objectives (eg. 95% of responses below 300ms), with penalties if the agreement is broken. Sometimes financial ones. These indicators, objectives and agreements go by the acronyms <a href="https://landing.google.com/sre/sre-book/chapters/service-level-objectives/">SLI, SLO and SLA</a>. Makes it enterprisey, I guess.</p><p>The tension between reliability and development agility, or simply between operations and development, is faced head-on in a couple of other ways.</p><p>One is the notion of an <a href="https://landing.google.com/sre/sre-book/chapters/embracing-risk">error budget</a>, an allowed amount of errors or of lowered performance than what an objective in an agreement defines for a given time window. Let’s say the agreed limit to the amount of requests taking longer than 300ms is 5%. Developers can continue to deploy new features as long as this limit is respected. But if exceeded, action needs to be taken to improve the service so the metric is respected — and that means sometimes stopping development altogether and focusing solely on reliability improvements.</p><p>The other is ensuring the amount of operational work done by an SRE engineer is always balanced with project work. Here it gets fuzzy for me whether that’s meant to be work on features as well as reliability and deployment pipeline engineering. Given Google seems to have dedicated SRE teams, I figure it’s only the latter, though that seems to conflict with the DevOps idea to break down the barriers between ops and devs. In any case, at least this ensures the SRE engineer doesn’t get trapped into repetitive operational work (what they call <a href="https://landing.google.com/sre/sre-book/chapters/eliminating-toil/">toil</a>), and that automation of deployment and reliability work is continued. There’s also limitations on how much on-call is done, with prescribed rotation, and protections to keep interruptions to a minimum. Complementing the checks and balances to avoid operational overload and us-vs-them conflicts is the culture of <a href="https://landing.google.com/sre/sre-book/chapters/postmortem-culture/">blameless postmortems</a>, which is a great way to analyze what went wrong during an outage without crucifying whoever was on call that day, or whoever submitted the change that caused the breakage.</p><p>There’s a lot more to it than this short summary, of course, and this is only what stuck with me. But I’m surprised by how much came out as I put it to “paper” — the approach makes a lot of sense to me, one practice fits into the other nicely, it’s obviously distilled from a lot of real-world experience inside Google, and the essays in the book seem earnest in discussing how it came about. Not to mention that Google apps’ reliability and the company’s speed in delivering new features and whole new products is well known, so it definitely seems to be working very well for them.</p><p>The caveat is that, from my experience, it takes a LOT to get to this point of structured process. Your app and infrastructure need to be fully instrumented for observability, the app/service team (and management) need to be fully bought into the mindset, or else the tendency to postpone reliability and deployment pipeline work in favor of delivering features, and to just dump that work on the few that happen to know more or is more curious about ops, or were already the sysadmins before, is very strong. I’ve heard of several cases where companies simply renamed their sysadmin or ops team “SRE” and did little more, just to get the PR effect. Like so often happens with Scrum, it has a real danger of only being adopted as a label.</p><p>It’s still a very worthwhile read, and changes can (and should) be implemented piecemeal as the team feels prepared to take the necessary jumps.</p><h3>Fragmented / on going readings</h3><p><a href="https://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912">Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation</a>, by Jez Humble and David Farley, and <a href="https://www.amazon.com/Succeeding-Agile-Software-Development-Using/dp/0321579364">Succeeding with Agile: Software Development Using Scrum</a>, by Mike Cohn</p><p>These are two books I’ve seen on quite a few desks of frazzled software development managers, engineer leads and ops people, in companies big and small. Years ago I took them for tokens of wishful thinking, statements of intention, moral compasses. Like bibles in police precincts. The Addison-Wesley Signature Series in general always looked intimidating for some reason, too. I always preferred books like <a href="https://basecamp.com/books">the ones by 37 Signals</a> (now Basecamp). Still do, honestly.</p><p>But I started getting into Martin Fowler’s and Kent Beck’s stuff, and design and patterns literature in general, despite how intimidating the enterprise engineering books looked. The Ruby community made reading <a href="https://www.amazon.com/Refactoring-Ruby-Addison-Wesley-Professional/dp/0321984137">Refactoring: Ruby Edition</a> and <a href="https://www.amazon.com/Design-Patterns-Ruby-Russ-Olsen/dp/0321490452">Design Patterns in Ruby</a> accessible, by praising and recommending them in a friendly and unpretentious way. The <a href="https://rspec.info/">Rspec</a> community did the same with TDD — though I never read <a href="https://www.amazon.com/Test-Driven-Development-Kent-Beck/dp/0321146530">Test Driven Development: By Example</a> (and probably should at some point), they translated the concepts in <a href="https://pragprog.com/book/achbd/the-rspec-book">The Rspec Book</a> and plenty of tutorials, blog posts and forum discussions, all in a informal and friendly style as well.</p><p>The Ruby BDD crowd also got me reading <a href="https://www.amazon.com/User-Stories-Applied-Software-Development/dp/0321205685">User Stories Applied</a> by Mike Cohn, as a way to approach writing acceptance tests and improve requirement building in general with customers and clients. I loved that book and to this day I refer back to it.</p><p>And lately, as I get more actively involved in DevOps and development processes in general, and Scrum seems ubiquitous even in startups, I’ve felt the pull to pick Continuous Delivery and Succeeding with Agile up and get the goods from the source.</p><p>Specially because they talk about <strong>getting</strong> <strong>adoption</strong>. I feel these days most people will agree in principle that CD and agile are worthy practices, but a lot will have varying strong opinions on how to implement them, how far to go, and even what the terminology means (specially with Scrum). Experiences with the necessary cultural change involved vary immensely, as do reasons for resistance to it. Cultural change is hard, to say the least.</p><p>So far I’ve read through the <em>Foundations</em> in Continuous Delivery, and some of <em>The Deployment Pipeline</em>. The main points sticking with me are the benefits of automation and frequent releases, such as reducing human errors, freeing developers to do more stimulating work, and drastically lowering the time between development and feedback from customers. These are points repeated at every chapter, you can tell the authors are trying to drill home that it makes sense, that <em>it’s possible </em>— they’ve done it and seen it done several times.</p><p>From keeping everything in version control, making the development and staging environments as similar as possible as the production environment, making monitoring visible to the teams, to making teams cross-functional, succeeding and failing as team — all tenets that are familiar one way or another, in common practice today, if not all together in the same place. With an origin-story feel, practices derived from experience.</p><p>There’s some overlap with the SRE book of course, as Continuous Delivery is a core foundation for SRE and DevOps in general. And some relation to Succeeding with Agile, with regards to team organization and Scrum rituals like retros.</p><p>I’ve only read the first few initial chapters of the latter, but it’s already been useful, as it starts by addressing why adopting Scrum is hard, and gives a run through of strategies to get companies and teams to adapt to it. It acknowledges that treating any methodology as an aim on itself, as an end-state, kills continuous improvement (<a href="https://en.wikipedia.org/wiki/Kaizen">Kaizen</a>). And that internal marketing efforts that try to sell Scrum backfire, many times building resistance against it instead, as it becomes the officially imposed corporate procedure. I like it that Mike Cohn recognizes this although he’s obviously fully vested in furthering the adoption of Scrum as his consulting business depends on it. He’s honest about the failures that exists, and looks for ways to mitigate them.</p><p>As an aside — it’s interesting that he’s in a spot where others like Martin Fowler, Kent Beck and DHH are at, where their babies got so famous and hugely adopted (Mike Cohn didn’t create Scrum, but is a major evangelizer for it), they are used in unexpected ways and there’s backlash against them. And these guys have to face going from heroes to villains, and go back to defend first principles. This is one of the side conclusions from the <a href="https://martinfowler.com/articles/is-tdd-dead/">Is TDD Dead? debate</a>, which is itself well worth a (really fun) listen.</p><p>The book then goes into strategies to get adoption and avoid the pitfalls, from ensuring there’s buy-in from both the top and the bottom of the organization, acknowledging that change will affect all areas of the business, not just the IT department, to focusing on selling the problems, not the solution. And then moves into describing a set of activities with its own acronym and all, ADAPT (Awareness, Desire, Ability, Promotion and Transfer), which is itself a, well, adaptation of ADKAR (Awareness, Desire, Knowledge, Ability and Reinforcement), a full-fledged <a href="https://en.wikipedia.org/wiki/Change_management">change management</a> model, and I’m just getting into where it gets fleshed out.</p><p>Once I make more progress on it, and on Continuous Delivery, I’ll post my new notes back here.</p><p>…And this post is getting really long :) I’ll leave my notes for Docker: Up &amp; Running and Microservices in Action for a third installment, coming soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=92a61c36388a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Filling the Gaps: Assorted Dev Readings]]></title>
            <link>https://medium.com/@oliver_azevedo_barnes/assorted-dev-readings-5f69bb9382bc?source=rss-f847cf33e8d7------2</link>
            <guid isPermaLink="false">https://medium.com/p/5f69bb9382bc</guid>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[elixir]]></category>
            <category><![CDATA[books]]></category>
            <dc:creator><![CDATA[Oliver Azevedo Barnes]]></dc:creator>
            <pubDate>Wed, 09 Oct 2019 16:45:36 GMT</pubDate>
            <atom:updated>2019-10-14T13:19:17.816Z</atom:updated>
            <content:encoded><![CDATA[<p>During a couple of extended downtimes between contract projects this year, and after a pretty good (and intense) three year run of continuous work, I took the time to read-up on different topics I felt I had knowledge gaps on as a developer, stuff I had encountered at work and wanted to delve deeper into, and on things I was just plain curious about. These varied from advanced SQL, Bitcoin, Elixir/OTP, to Microservices and Docker, in no special order.</p><p>Also, during a month of waiting on a kafkian client background check, I dug into <a href="https://landing.google.com/sre/#sre">Site Reliability Engineering</a>, Google’s flavor of DevOps, in preparation for the project.</p><p>It’s great, suddenly having long stretches of free time available to read in depth, rather than having to scramble and learn by fire on the job, and just pursue my curiosity with time to spare. Therapeutic in keeping good old impostor syndrome at bay, while the next gig doesn’t come around. Reading while coding a <a href="https://github.com/oliverbarnes/liquid-voting-service">personal project</a> (a topic for another blog post), and starting this blog.</p><p>Once on the aforementioned gig, I did some fragmented readings on implementing Scrum and Continuous Delivery, as part of digital transformation projects, and am continuing with them after the project was over. These are now part of that reading pile that gets read slowly in parallel, rotating from time to time.</p><p>Blogging about these books is a way to make sense of what I got from them, and a way to contribute to their visibility, hopefully spiking someone else’s interest. Not that there’s any shortage of reviews for these books, some are very well known and a couple are seminal even, but I find different takes often helps in deciding whether to take the dive or not.</p><p>In the end all these books have been useful, even if just parts of them. I recommend checking them out if you get a chance:</p><ul><li><a href="https://pragprog.com/book/bksqla/sql-antipatterns">SQL Antipatterns</a></li><li><a href="https://www.amazon.com/gp/product/1491954388">Mastering Bitcoin</a></li><li><a href="https://pragprog.com/book/jgotp/designing-elixir-systems-with-otp">Designing Elixir Systems with OTP</a></li><li><a href="https://www.amazon.com/Site-Reliability-Engineering-Production-Systems/dp/149192912X">Site Reliability Engineering</a></li></ul><p>Fragmented / ongoing readings:</p><ul><li><a href="https://www.amazon.com/Continuous-Delivery-Deployment-Automation-Addison-Wesley/dp/0321601912">Continuous Delivery</a></li><li><a href="https://www.amazon.com/Succeeding-Agile-Software-Development-Using/dp/0321579364">Succeeding with Agile</a></li><li><a href="https://www.amazon.com/Docker-Up-Running-Karl-Matthias/dp/1491917571">Docker: Up &amp; Running</a></li><li><a href="https://www.manning.com/books/microservices-in-action">Microservices in Action</a></li></ul><p>This post has notes on the first three above. Another post will come with a full review of the SRE book, and random notes on the remainder list.</p><p><a href="https://pragprog.com/book/bksqla/sql-antipatterns">SQL Antipatterns: Avoiding the Pitfalls of Database Programming</a>, by Bill Karwin.</p><p>I learned about this book from an excellent presentation by <a href="https://medium.com/u/40864deeb291">Brad Urani</a>, <a href="https://www.youtube.com/watch?v=zo3iRBPzscU">Rails anti-patterns: how not to design your database</a>, at Euruko 2018. At the end of it he recommended two books, one he said was <a href="https://www.amazon.com/Hierarchies-Smarties-Kaufmann-Management-Systems/dp/0123877334/ref=sr_1_1?__mk_es_ES=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;keywords=Joe+Celko%E2%80%99s+Trees+and+Hierarchies+in+SQL+for+Smarties">super-dry but complete</a>, and Bill Karwin’s one - saying one could actually read it cover to cover. And I can attest to that. It’s no <a href="https://www.amazon.com/New-York-2140-Stanley-Robinson/dp/031626234X">Kim Stanley Robinson page-turner</a>, but it’s well-written, with clear and down to earth explanations for why a given anti-pattern is bad, how to detect it, where it can be ok to use it, and what to use instead when not. It’ll bring about realizations on memories of gnarly ORM code and SQL spaghetti you’ve seen, and worse, written.</p><p>The parts that stuck with me the most were the one on trees (I keep coming back to it to refresh on <a href="https://www.slideshare.net/billkarwin/sql-antipatterns-strike-back/77-Naive_Trees_Summary_of_Designs">the different available patterns</a>), and polymorphic associations (he doesn’t like them and recommends a <a href="https://www.slideshare.net/billkarwin/sql-antipatterns-strike-back/40-Polymorphic_Assocations_Solution_1_exclusive">few different alternatives</a>, while acknowledging it can be hard when a framework pushes you towards them).</p><p>Overall, for me it refreshed and reasserted fundamentals of SQL and relational databases, like normalization (and denormalization) and referential integrity, and recommendations such as not to mix data with metadata. The walk-throughs of scenarios considering what the reads and writes are like with each pattern, always keeping the trade-offs in sight, were great exercises. Several months past reading the book, I just feel more literate when going over complex SQL and db schemas, with a better sense of the design choices, good and bad. And better tooled to change them.</p><p><a href="https://www.amazon.com/gp/product/1491954388">Mastering Bitcoin: Programming the Open Blockchain</a>, by Andreas M. Antonopoulos.</p><p>I think the SQL Antipatterns book gave me the stomach to read this one cover to cover too, after all a blockchain is a type of database. But of course, Bitcoin is also a lot more than that, it’s a network and a protocol as well. And to some, a virus to change finance. Though the writing is not super-fluid and code samples could be more concise, the author, who’s a famous Bitcoin evangelist, does a good job of explaining how it works, the problems it’s trying to solve in distributed computing, the architectural choices. And its mission, which depending on where you stand, can be more or less convincing. But definitely worth understanding.</p><p>The development process is interesting too. Due to the intended permanent nature of the Bitcoin blockchain and its data, in a way it seems like coding it is an endless legacy project, and for every proposed change there’s a complex process of approval by developers and then adoption from miners and validating nodes.</p><p>The whole thing is <em>very</em> different from mainstream web software engineering, and being exposed to a different paradigm is well worth it.</p><p><a href="https://pragprog.com/book/jgotp/designing-elixir-systems-with-otp">Designing Elixir Systems with OTP: Write Highly Scalable, Self-Healing Software with Layers</a>, by James Edward Gray, II and Bruce A. Tate.</p><p>I follow <a href="https://twitter.com/jeg2">JEG2</a> since the time he was a RubyRogue with <a href="https://twitter.com/avdi">avdi</a> and <a href="https://twitter.com/jessitron">jessitron</a>, and always loved their perspective on software engineering, going into thought processes and psychology, coding as communication, and continuous learning. I got the book after listening to <a href="https://elixirstatus.com/p/3uuE-elixirmix-podcast-063---designing-elixir-systems-with-otp-with-bruce-tate-and-james-gray">him and Bruce Tate discuss the book on Elixir mix</a> in August, where they also talked about the writing process. It’s a fun read, it’s fluid and careful to make concepts and steps intuitive to non-Elixir devs (which I still consider myself to be, though I have been playing with Elixir for a few years). It focuses a lot on separation of concerns and boundaries, as to keep the app both easy to change and to scale as needed. It walks you through building a non-trivial pure OTP app core, and takes a data-first approach, nudging you towards putting in some effort in upfront design of data structures, before worrying about persistence or OTP processes. It’s interesting to see how organizing code around concepts is still paramount, and the way they do it in the book feels organic, not at all trying to retrofit OO patterns into functional.</p><p>When starting on that personal project I mentioned earlier, I began prototyping a pure OTP app following the book’s proposed flow, and playing with the resulting structures on the iex console. That made me think hard about Elixir structures like tuples and maps, about how I wanted to access the data and what the interface to the concept should be. Once I started the implementation in earnest though, I quickly dropped the pure elixir core talking to a Phoenix app shell, and went straight to ecto models, but decoupled from logic with <a href="https://hexdocs.pm/phoenix/contexts.html">Phoenix contexts</a> — which are proving to be an elegant way to separate concerns and to separate business logic from persistence, and make a lot more sense after playing with a pure OTP app.</p><p>The book suggests resisting creating a process with GenServer until it’s clear it’s needed, and it does a good job of explaining when it’s so, specially regarding code that has side effects. In my early stage prototype it was really hard for me to tell, and again, once hopping on Phoenix it just took care of some of this out of the box. The Ecto repo for instance will run its own OTP application. But now it’s easy understand why that is, and to see how a context might evolve to later have its own process, or its own OTP application, eventually. Or even its own separate micro-service. The subject of the next book on the list.</p><p>PS. on the ElixirMix podcast James and others strongly recommend <a href="https://www.youtube.com/watch?v=JvBT4XBdoUE">https://www.youtube.com/watch?v=JvBT4XBdoUE</a> by <a href="https://twitter.com/sasajuric">Saša Jurić</a>, the author of <a href="https://www.manning.com/books/elixir-in-action-second-edition">Elixir in Action</a>. It’s really a great presentation on OTP processes and on how the BEAM works, complements the book nicely.</p><p>Next up: <a href="https://medium.com/@oliver_azevedo_barnes/filling-the-gaps-assorted-dev-readings-part-ii-92a61c36388a">Review of Site Reliability Engineering, and random notes on Continuous Delivery and Succeeding with Agile</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5f69bb9382bc" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>