week 07, 2020

Graph Neural Networks: An overview

Graph Neural Networks were introduced back in 2005 (like all the other good ideas) but they started to gain popularity in the last 5 years. The GNNs are able to model the relationship between the nodes in a graph and produce a numeric representation of it. The importance of GNNs is quite significant because there are so many real-world data that can be represented as a graph. Social networks, chemical compounds, maps, transportation systems to name a few. So let’s find out the basic principles behind GNNs and why they work.

Source: Graph Neural Networks - An overview, an article by Sergios Karagiannakos.

Tips on reading and debugging other programmers' code

Most IT firms where I worked as programmer were IT services industry, there was very little greenfield work and most of the time we had to maintain/fix code written by other engineers who couldn't even be found in some cases!

As a result, reading and debugging existing code was something we had to adapt ourselves to. Based on my experience, this is a brief overview of how the process generally works and some tricks to make your life easier:

Source: Tips on reading and debugging other programmers' code, an article by Prahlad Yeri.

Go interfaces: small and composable

Interfaces in Go are a topic that tend to trip up people coming from a variety of languages like Java or C#. The oddest thing about them is probably that interfaces are implicit rather than explicit . So whereas in most languages there is some type of syntax or a keyword to say you’re implementing an interface, there’s no such thing in Go.

Another difference is that good interfaces in Go should be small — they should contain only a few methods. I know how tempting it is to just add one more method to an interface, and have them grow organically like that. This does create some downsides in terms of having others use your interface and refactor work if you change them later.

Source: Go interfaces: small and composable, an article by Dylan Meeus.

Library Evolution in Swift

Swift 5.1 shipped with two new features related to binary stability that enables binary frameworks that can be distributed and shared with others:

  • Module stability allows Swift modules built with different compiler versions to be used together in one app.

  • Library evolution support allows developers of binary frameworks to make additive changes to the API of their framework while remaining binary compatible with previous versions.

Source: Library Evolution in Swift, an article by Slava Pestov.

Reducing Colors In An Image ⇢ Dithering

What if you did not have millions of colors at your disposal? Think about older devices, printers (both 2D and 3D), or printing presses making giant posters of your favorite movie. You may also want to reduce your color palette to reduce the memory usage.

What you need is some sort of mapping, that maps the pixel with 16 million possible colors, to say 8 possible colors. Intuitively, the best approach would be to figure out which of the 8 colors is most similar to the pixel's color and use this similarity for mapping.

Source: Reducing Colors In An Image ⇢ Dithering, an article by Preet Shihn.

An introduction to GDB scripting in Python

Sometimes it's not humanly possible to inspect or modify data structures manually in a debugger because they are too large or complex to navigate. Think of a linked list with hundreds of elements, one of which you need to locate. Finding the needle in the haystack is only possible by scripting the debugger to automate repetitive steps.

Source: An introduction to GDB scripting in Python, an article by Stefan Hajnoczi.

Why do so many developers get DRY wrong?

Dan Abramov’s excellent Goodbye, Clean Code post (wherein he learned it was wise to walk back an overzealous refactoring) reminded me of something Dave Thomas said when we interviewed him and Andy Hunt about the Pragmatic Programmer’s 20th edition:

We’ve also looked at the reaction to various parts of the book, and discovered that we weren’t really communicating as well as we thought we were some of the ideas that we had. A classic one is DRY. DRY has come to mean “Don’t cut and paste”, but the original “Don’t repeat yourself” was nothing to do with code, it was to do with knowledge. So we’ve had to go through and update that… [🎧]

Source: Why do so many developers get DRY wrong?, an article by Jerod Santo.

Dark Age: Disappointing

In the late afternoon I finished Dark Age, the fifth book in the Red Rising series by Pierce Brown. I was disappointed by this book; especially because book four in this series, Iron Gold, was excellent.

The book got better about half way; good enough to look forward to the next one in the series, which I hope will be more like Iron Gold or Red Rising. But overall; barely an OK.

The Museum of Desire

LAPD Lieutenant Milo Sturgis has solved a lot of murder cases. On many of them—the ones he calls “different”—he taps the brain of brilliant psychologist Dr. Alex Delaware. But neither Alex nor Milo are prepared for what they find on an early morning call to a deserted mansion in Bel Air. This one’s beyond different. This is predation, premeditation, and cruelty on a whole new level.

In the late afternoon I started in the 35th book in the Alex Delaware series by Jonathan Kellerman: The Museum of Desire.

Unexpected Places You Can And Can’t Use Null Bytes

The traditional way of representing strings in C is using null-terminated character arrays. Common C library methods like strcpy, printf, etc. detect how long strings are by sequentially scanning memory until a null byte is found. This complicates situations where the string data itself should contain literal null bytes. Generally this doesn’t mean that it’s impossible to use strings with embedded null characters, just that you have to be more careful when doing so. Typically this is done by using methods that explicitly specify the length of strings.

Source: Unexpected Places You Can And Can’t Use Null Bytes, an article by Evan Klitzke.

The economics of clean code

There seem to be many opinions surrounding clean code. Some people have an entire architecture of how code should look. Others stick to the actual layout of the code, or length of a class while even others vaguely point towards Robert C. Martin’s books.

One thing is clear; it’s something that’s really on a lot of developers mind. Clean code makes projects more comfortable to work with and improves shelf life. It’s the antagonist of vile legacy codebases that are unmaintainable.

Then why does business always treat it as a secondary objective? Do they just don’t get it?

Source: The economics of clean code, an article by Frederick Vanbrabant.

Tools in My Toolbox

One of the most important skills I believe programmers need is to understand when to use certain tools. My typical process for solving a problem is to go through each tool in my toolbox and see which one would solve the problem the best. Over the past few years, I’ve worked on systems that process 100s of billions of data points. In doing so, I’ve added a number of tools to my personal toolbox.

Source: Tools in My Toolbox, an article by Michael Malis.

Merge Sort - Divide and Conquer

When you are faced with a huge task, what do you usually do? Well, if you’re a little bit like me, then you split it into smaller chunks, complete them individually and later combine into a bigger one. This exact approach is used by Merge Sort. Following article will cover its implementation with detailed explanation, including a study of dreadful (not really) recursion. Ready?

Source: Merge Sort - Divide and Conquer, an article by Mateusz Dziubek.