week 19, 2020

Alice and the red cat

On our way to my mother's house we encountered a red cat. Alice walked towards it and started to pet it.

Alice petting a red cat
Alice petting a red cat.

Propagating user-facing errors in Swift

If it’s one thing that almost all programs have in common is that they will, at some point, encounter some form of error. While some errors might be the result of bugs and failures caused by faulty code, incorrect assumptions, or system incompatibilities — there are also multiple kinds of errors that are completely normal, valid parts of a program’s execution.

One challenge with such errors is how to propagate and present them to the user, which can be really tricky, even if we disregard tasks like crafting informative and actionable error messages. It’s so incredibly common to see apps either display a generic ”An error occurred” message regardless of what kind of error that was encountered, or throw walls of highly technical debugging text at the user — neither of which is a great user experience.

So this week, let’s take a look at a few techniques that can make it much simpler to propagate runtime errors to our users, and how employing some of those techniques could help us present richer error messages without having to add a ton of complexity within each UI implementation.

Source: Propagating user-facing errors in Swift, an article by John Sundell.

ZFS 101—Understanding ZFS storage and performance

To really understand ZFS, you need to pay real attention to its actual structure. ZFS merges the traditional volume management and filesystem layers, and it uses a copy-on-write transactional mechanism—both of these mean the system is very structurally different than conventional filesystems and RAID arrays. The first set of major building blocks to understand are zpools, vdevs, and devices.

Source: ZFS 101—Understanding ZFS storage and performance, an article by Jim Salter.

Calculating Streaks in Pandas

A streak is when several events happen in a row consecutively. In this post, we’re going to be working with NBA shot data and looking at players who made or missed a number of shots in a row. That said, streaks can take many forms. You can just as easily use this technique to detect and measure other streaks like consecutive days logging in to an app or website.

Source: Calculating Streaks in Pandas, an article by Josh Devlin.

A Guide to Big O notation

You have probably come across big O notation before. Maybe you have read that merge sort is better than insertion sort because merge sort is O(n log ⁡n) compared to insertion sort, which is O(n2). In this article, you'll understand what this means, and why this makes merge sort the better algorithm.

Source: A Guide to Big O notation, an article by Erik André Jakobsen.

JavaScript magic with Symbols

A symbol is a primitive data type introduced in ES6. It's created with Symbol function and globally unique. Symbols can be used as object properties to provide uniqueness level access to objects and as hooks into built-in operators and methods, enabling us to alter the default behavior of JavaScript.

Source: JavaScript magic with Symbols, an article by Marko Marinovic.

Emacs is Not Just An Editor

The editor war between users of the vim editor and the Emacs editor exists since decades. Here is my comment on that as somebody who is using vim and GNU/Emacs intensive on a daily basis.

In my opinion, the most dominant advantage of Emacs is that it's not just an editor: it's a LISP interpreter and thus a very capable highly dynamic platform.

Source: Emacs is Not Just An Editor, an article by Karl Voit.

JSON Parsing from Scratch in Haskell

JSON is probably the most used standard file format for storing and transmitting data on the internet in recent times. Though it was historically derived from JavaScript, it is a programming language independent format and is now supported by almost all languages. JSON has a simple syntax specification with only four scalar data types and two composite data types. So, writing a parser for JSON is a great exercise for learning the basics of parsing. Let’s write one from scratch in Haskell.

Source: JSON Parsing from Scratch in Haskell, an article by Abhinav Sarkar.