Plurrrr

week 25, 2021

Observing containers

Containers, Kubernetes, and microservices have enabled operations teams to move ever faster, producing more applications, packaging them up, and scaling them to meet users’ needs. But as infrastructure scales, it generates more data, and developers have to work harder to cut through the noise.

The three pillars of observability—metrics, logs, and tracing—are a great place to start. Let’s explore the benefits, challenges, and use cases of each to come away with a stronger understanding of how to make the most of our container data.

Source: Observing containers with the three pillars of observability, an article by Frederic Branczyk.

Functors and Monads For People Who Have Read Too Many "Tutorials"

Title is literally true. This may not be the best place to learn about these concepts for the first time, because I'm going to focus on knocking down the misconceptions about them.

Then again, it may not be the worst place, for the same reason.

I had promised myself I would not add to the pile of functor or monad "tutorials", but I've been worn down. I gave up when I saw a reddit comment complaining about how Functor was "too hard to understand", which made me sad, because the correct response to the Functor interface is, "That's it?". And while Monad is legitimately a bit more interesting and complex, the correct response to that is not that different.

Source: Functors and Monads For People Who Have Read Too Many "Tutorials", an article by Jeremy Bowers.

Exceptional Naming

One of the hardest things in software development is naming. Naming of products, of paradigms and of parts of your code. The reason naming is both hard and important is because it is an act of communication; without good names your code might as well be written in, well, code. A name is not simply a label: it informs and guides the reader’s mental model. Names can change the way the reader thinks. A good name is a sharing of minds; a poor name is a missed opportunity to learn and say what we mean.

Source: Exceptional Naming an article by Kevlin Henney.

The State of Python Packaging in 2021

Every year or so, I revisit the current best practices for Python packaging. I.e. the way you’re supposed to distribute your Python packages. The main source is packaging.python.org where the official packaging guidelines are. It is worth noting that the way you’re supposed to package your Python applications is not defined by Python or its maintainers, but rather delegated to a separate entity, the Python Packaging Authority (PyPA).

Source: The State of Python Packaging in 2021, an article by Bastian Venthur.

Harry Potter and the Goblet of Fire (2005)

Harry Potter finds himself competing in a hazardous tournament between rival schools of magic, but he is distracted by recurring nightmares.

In the evening, Esme, Alice, and I watched Harry Potter and the Goblet of Fire. Adam didn't want to watch; he had a cold and was not feeling well.

I had seen this movie before on the big screen back in Xalapa, Mexico. Back then I considered the movie chaotic and rated it only a 6 out of 10. I still stand with the chaotic part, but maybe the movie has grown upon me because I now give it a 7.5 out of 10.

Hierarchical Structures in PostgreSQL

It's a common pattern: a database developer at a startup is probably on the Product subteam of the Engineering team at their company. In a department store, shoes are a subcategory of clothing, while your favorite thermos is probably in the travel department.

In any Github organization, there are teams within teams within teams. In any large department store there are categories deeply nested. In any recipe book, there are many ways to classify food.

So how can we model them?

Source: Hierarchical Structures in PostgreSQL.

Python Data Viz Libraries Compared

I'm teaching a course about the essential tools of Data Science. Among those, I'm going to cover how to use some of the most popular data visualization libraries in Python: pandas (yes, that's not a typo!), matplotlib, seaborn, and plotly.express.

I thought it be useful for my students to have cheat sheet with some popular graphs made with each of these tools. So I wrote this cheat sheet.

In the next sections, you'll learn how to set up your local environment, read the data, and get the code to make the following types of graphs:

  • Line plot
  • Grouped bars plot
  • Stacked bars plot
  • Area chart
  • Pie/Donut chart
  • Histogram
  • Scatter plot
  • Boxplot

Let me know what you think!

Source: Python Data Viz Libraries Compared: 8 Popular Graphs Made with pandas, matplotlib, seaborn, and plotly.express, an article by Dylan Castillo.

“Weak declaration”

PPK looks at aspect-ratio, a CSS property for layout that, for the most part, does exactly what you would think it does. It’s getting more interesting as it’s behind a flag in Firefox and Safari now, so we’ll have universal support pretty darn soon. I liked how he called it a “weak declaration” which I’m fairly sure isn’t an official term but a good way to think about it.

Source: "Weak declaration", an article by Chris Coyier.

Normalization is not a process

Database normalization is often explained as a step-by step process to improve a database design. This is a very unfortunate misunderstanding which causes a lot of confusion for students. Instead, the normal forms should be thought of as a checklist which can be used to analyze a database design for potential problems.

Source: Normalization is not a process.

Subclassing in Python Redux

The conflict between subclassing and composition is as old as object-oriented programming. The latest crop of languages like Go or Rust prove that you don’t need subclassing to successfully write code. But what’s a pragmatic approach to subclassing in Python, specifically?

Source: Subclassing in Python Redux, an article by Hynek Schlawack.

Upgrade Your SSH Key to Ed25519

If you’re a DevOps engineer or a web developer, there’s a good chance that you’re already familiar and using the SSH key authentication on a daily basis. Whether it’s for logging into the remote server or when pushing your commit to the remote repository. It provides us with better security than the traditional password-based authentication.

But, when is the last time you created or upgraded your SSH key? And did you use the latest recommended public-key algorithm? If it was more than five years ago and you generated your SSH key with the default options, you probably ended up using RSA algorithm with key-size less than 2048 bits long.

Source: Upgrade Your SSH Key to Ed25519, an article by Risan Bagja Pradana.

See also my SSH Public Key Authentication How To.

Perl / Unix One-liner Cage Match, Part 1

A shell (like Bash) provides built-in commands and scripting features to easily solve and automate various tasks. External commands like grep, sed, Awk, sort, find, or parallel can be combined to work with each other. Sometimes you can use Perl either as a single replacement or a complement to them for specific use cases.

Perl is the most robust portable option for text processing needs. Perl has a feature rich regular expression engine, built-in functions, an extensive ecosystem, and is quite portable. However, Perl may have slower performance compared to specialized tools and can be more verbose.

Source: Perl / Unix One-liner Cage Match, Part 1, an article by Sundeep Agarwal.

Measuring memory usage in Python: it’s tricky!

If you want your program to use less memory, you will need to measure memory usage. You’ll want to measure the current usage, and then you’ll need to ensure it’s using less memory once you make some improvements.

It turns out, however, that measuring memory usage isn’t as straightforward as you’d think. Even with a highly simplified model of how memory works, different measurements are useful in different situations.

In this article you’ll learn:

  • A simplified but informative model of how memory works.
  • Two measures of memory–resident memory and allocated memory–and how to measure them in Python.
  • The tradeoffs between the two.

Source: Measuring memory usage in Python: it’s tricky!, an article by Itamar Turner-Trauring.

What Every Programmer Should Know About SSDs

Solid-State Drives (SSDs) based on flash have largely replaced magnetic disks as the standard storage medium. From the perspective of a programmer, SSDs and disks look very similar: both are persistent, enable page-based access through file systems and system calls, and have large capacities.

However, there are also important differences, which become important if one wants to achieve optimal SSD performance. As we will see, SSDs are more complicated and their performance behavior can appear quite mysterious if one simply thinks of them as fast disks. The goal of this post is to provide an understanding of why SSDs behave the way they do, which can help creating software that is capable of exploiting them. (Note that I discuss NAND flash, not Intel Optane memory, which has different characteristics.)

Source: What Every Programmer Should Know About SSDs, an article by Viktor Leis.

What is memory safety and why does it matter?

Memory safety is a property of some programming languages that prevents programmers from introducing certain types of bugs related to how memory is used. Since memory safety bugs are often security issues, memory safe languages are more secure than languages that are not memory safe.

Memory safe languages include Rust, Go, C#, Java, Swift, Python, and JavaScript. Languages that are not memory safe include C, C++, and assembly.

Source: What is memory safety and why does it matter?

What’s new in SwiftUI for iOS 15

Expectations were always going to be high for SwiftUI this year, but the team didn’t disappoint – they’ve shipped a massive collection of improvements and features, including a new AsyncImage view for loading remote images, swipe actions for list rows, pull to refresh, plus shorter, simpler APIs for common uses. Alongside huge improvements to Swift itself (see What's new in Swift 5.5 for more on that), this is another significant leap forward for SwiftUI and I’m really keen to dive in.

Source: What’s new in SwiftUI for iOS 15, an article by Paul Hudson.