Plurrrr

week 36, 2022

Neither self nor this: Receivers in Go

Go does not have classes and objects, but it does have types that we can make many instances of. Further, we can attach methods to these types and they kind-of start looking like the classes we’re used to. When we attach a method to a type, the receiver is the instance of the type for which it was called.

Choosing the name of a receiver is not always a trivial task. Should we be lazy and name them all the same (like this or self)? Or treat them not unlike local variables by abbreviating the type (like srv to a Server type )? Or maybe something even more nuanced?

And what are the consequences? How will our code suffer if we choose one approach over the other? Let's explore.

Source: Neither self nor this: Receivers in Go, an article by Andrey Petrov.

The case for self receivers in Go

Ok ok, hear me out. I know you're already lighting torches and sharpening your pitchforks (Side note: Can you sharpen a pitchfork?). I know I'm probably in the minority here, so please allow the little-guy to make a small case for the use of self as a receiver name.

Source: The case for self receivers in Go, an article by Cody Potter.

Learning Rust: Combinators

Combinators are a very interesting to make your code cleaner and more functional. Almost all the definitions you'll find on the internet will make your head explode 🤯 because they raise more questions than they answer.

Thus, here is my empiric definition: Combinators are methods that ease the manipulation of some type T. They favor a functional (method chaining) style of code.

Source: Learning Rust: Combinators, an article by Sylvain Kerkour.

This is not your grandfather’s Perl

If you were to search the internet for recent articles about Perl, you might well be led to believe that the language hasn’t changed in the last twenty years. And, sadly, that’s a completely understandable belief as the major version number hasn’t changed since 1994.

Source: This is not your grandfather's Perl, an article by Dave Cross.

Optimising Docker Layers for Better Caching with Nix

Nix has been able to generate Docker images for several years now, however the typical approach to layering with Nix is to generate one fat image with all of the dependencies. This fat image offers no sharing, is slow to build, upload, and download.

In this post I talk about how I fix this problem and use Nix to automatically create multi-layered Docker images, allowing a high amount of caching between images.

Source: Optimising Docker Layers for Better Caching with Nix, an article by Graham Christensen.

Cold, Cold Bones

In a profession like this, you're bound to make enemies . . .

It all starts when Dr Temperance Brennan finds a box on her porch. Inside is a fresh human eyeball with GPS coordinates etched into it. They lead her to a macabre discovery in a Benedictine Monastery, and soon after she discovers a mummified corpse in a state park.

There seems to be no pattern to these killings, except that each mimics a killing connected to something a younger Tempe experienced, or barely escaped. Someone is targeting her, and she needs to figure out why before they strike again.

And then her daughter Katy disappears.

Someone is playing a dangerous game with Tempe. And they won’t stop until they have taken everything from her . . .

In the evening I started in Cold, Cold Bones by Kathy Reichs.

Static site hosting hurdles

When it comes to static sites, there are a myriad of solutions for authoring and compiling, but talk about hosting these static sites, and we are still in the early 2000s. I discuss the challenges one faces when hosting, and even make a proposal to solve some of these.

Source: Static site hosting hurdles, an article by Ciprian Dorin Craciun.

Userspace FUSE for macOS

FUSE-T is a kext-less implementation of FUSE for macOS that uses NFS v4 local server instead of a kernel extension.

The main motivation for this project is to replace macfuse (https://osxfuse.github.io/) that implements its own kext to make fuse work. With each version of macOS it's getting harder and harder to load kernel extensions. Apple strongly discourages it and, for this reason, software distributions that include macfuse are very difficult to install.

Source: Userspace FUSE for macOS.

Critical CSS? Not So Fast!

I have long held very strong opinions about the Critical CSS pattern. In theory, in a perfect world, with all things being equal, it’s demonstrably a Good Idea™. However, in practice, in the real world, it often falls short as a fragile and expensive technique to implement, which seldom provides the benefits that many developers expect.

Source: Critical CSS? Not So Fast!, an article by Harry Roberts.

Postgres Partitions

There is a common misconception that partitioning a table in Postgres will improve performance, while it’s true in some cases, but sometimes partitioning may actually degrade your performance if done incorrectly.

Let me try to give a very brief overview about postgres partitioning in general and some guideline to consider before partitioning the table.

Source: Postgres Partitions, an article by John Pradeep Vincent.