Skip to main content

C#: Interface Variance

C# is more tightly coupled than C++. Everything has its place in the class hierarchy. The hierarchy is mainly composed of interfaces and classes.

Interfaces provide contracts for the implementation's capabilities, which classes then fill with life. We all know the scary legends from multiple inheritance and how it brought the diamond problem over the world once. Interfaces saved us. If you are lucky enough to use .NET 5.0 or later, you are not even required to pay the tribute of implementing their methods for each single class. Let us explore them a little more.

5 min ›

Abstract Machine

The first presentation on CppCon 2020 is from Bob Steagall. He gave an overview of the abstract machine, according to which C++ is defined. Here are my summary from the presentation, peppered with some complementary notes.

6 min ›

Nvim: Improved Automatic Indentation

I am still surprised by hidden gems in nvim. The Zig plugin improves indentation support for the language. Learning from the included script revealed nvims indentation options. You might want to adjust those to your own taste.

3 min ›

Hidden Friends

I describe what argument dependent lookup is. I show how it ensures the compilation of even most simple C++ programs. Then, I go over its disadvantages and how it can be used more efficiently through the hidden friends pattern.

6 min ›

Self-Signed TLS Certificate for Email

Upon setting up an email app on my Android device, I noticed that the self-signed TLS certificate for secure connections needs to include certain configuration options. Otherwise, Android would not accept it as a valid candidate. Here is the short write-up of the process.

3 min ›

Constraints and Concepts

I never dived too deeply into SFINAE as one would find madness lurking not far away down there. With C++20 around the corner it fortunately becomes only necessary for code of former standards. Concepts bring interesting features to C++ and I deliver a basic introduction to their usage.

11 min ›

Alternative Keyboard Layouts

The majority of people are typing on some variation of the QWERTY layout. Where does it come from? Have you ever wondered if there are better alternatives to it? If not, there is a completely new world for you to discover!

12 min ›

Nvim: Updating Header Comments

The alignment of documentation and code might be challenging. You either have to always keep in mind to update the relevant comments or they get deprecated really fast. Fortunately, using a powerful editor like nvim can help us with this challenge.

8 min ›

C#: Using IEquatable<>

In C# IEquatable<> is used to implement comparison of custom classes. Different solutions exist for the proper implementation of the required interface in regard to surrounding requirements. Especially the requirement for the hashing function is not immediately obvious in the context of comparison.

It took me some time to figure out the best approach. So, here it is.

13 min ›