Assorted dev readings – Oliver Barnes

0 36

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.

Also, during a month of waiting on a kafkian client background check, I dug into Site Reliability Engineering, Google’s flavor of DevOps, in preparation for the project.

It’s great, all of a sudden long stretches of free time available to read in depth, rather than having to scramble and learn by fire on the job, and also 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 personal project (a topic for another blog post), and starting this blog.

Once on the aforementioned gig, I did some fragmented readings as well on implementing SCRUM and Continuous Delivery, as part of digital transformation projects, and continued with them after the project was over.

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.

In the end all these books have been useful, even if just parts of them. I recommend all of them if you get a chance.

Here’s the mixed bag:

This post is about the first three, which were read cover to cover. Another post will come with notes about the remainder ones, of which the readings were more fragmented. Except for the SRE one, also read cover to cover.

SQL Antipatterns: Avoiding the Pitfalls of Database Programming, by Bill Karwin.

I learned about this book from an excellent presentation by Brad Urani, Rails anti-patterns: how not to design your database, at Euruko 2018. At the end of it he recommended two books, one he said was super-dry but complete, and Bill Karwin’s one – saying one could actually read it cover to cover. And I can attest to that. It’s no Kim Stanley Robinson page-turner, 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.

The parts that stuck with me the most were the one on trees (I keep coming back to it to refresh on the different available patterns), and polymorphic associations (he doesn’t like them and recommends a few different alternatives, while acknowledging it can be hard when a framework pushes you towards them).

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.

Mastering Bitcoin: Programming the Open Blockchain, by Andreas M. Antonopoulos.

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.

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.

The whole thing is very different from mainstream web software engineering, and being exposed to a different paradigm is well worth it.

Designing Elixir Systems with OTP: Write Highly Scalable, Self-Healing Software with Layers, by James Edward Gray, II and Bruce A. Tate.

I follow JEG2 since the time he was a RubyRogue with avdi and jessitron, 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 him and Bruce Tate discuss the book on Elixir mix 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.

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 Phoenix contexts — 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.

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.

PS. on the ElixirMix podcast James and others strongly recommend by Saša Jurić, the author of Elixir in Action. It’s really a great presentation on OTP processes and on how the BEAM works, complements the book nicely.

Next up: Microservices in Action, Docker: Up & Running, Site Reliability Engineering, Continuous Delivery and Succeeding with Agile

You might also like
WhatsApp chat