C#11preview: Type-safe interchangeable units

In a previous post, I discussed static abstracts in interfaces, and while it is quite a nice feature, it falls short in some corner cases – particularly in implicit type-conversions. I’m not sure if it should, but… it’s complicated. As an example, I will consider the concept of interchangeable units. Wouldn’t it be neat, if … Read more

C#11pre: static abstract interface members

C#10 was just released, but included in this years release is an early preview of C#11, and it contains quite an exciting change: static abstract members in interfaces. You might think, what’s the fuzz? Static members in interfaces is nothing new and was introduced in C#8! In this post I present a few more fruitful, … Read more

XUnit: Using TheoryData with Theory

In a previous post, we looked the newly introduced Assert.Multiple in the XUnit 2.4.2 assertion library. In this post, we will dive deeper into different ways of expressing tests and especially, test input. Facts are the simplest possible test-case in XUnit. They are self contained in that they contain the arrangement, act ,and assertion, but … Read more

Mimicking Delegates in C# with GOF Observers

How far could we get trying to implement our own delegate types? How are are delegates related the observer pattern? In this less serious but technically interesting post, we explore the relation between delegates and observers, look at how close we could and our ability to implement our own delegate type; or at least imitate … Read more

XUnit 2.4.2-pre: Multiple asserts in one test

Multiple asserts in test-cases are considered bad practice. The usual reason for this, is that if one assert fails, you will never se the result of the rest. And probably true, having a single assertion, improves defect localization and simplifies the tests. But sometimes… sometimes you wish you could have multiple conditions; and that it would be ok.

Are interfaces like contracts?

I have tought Object Oriented Programming for a number of years and in my time completed more than a thousand oral exams at bachelor level computer science and software engineering students. Overall, it seems object oriented programming can be difficult to comprehend, but clearly the concept of interfaces is one of the harder topics. Interfaces … Read more

HTMX — a better direction for HTML evolution?

The authors of HTMX (https://htmx.org/)suggests using simple hyper text when applicable, which turns out to be… often. Featured on the latest <.NET Rocks!/> podcast — 1749 htmx with Carson Gross htmx allows you to access AJAX, CSS Transitions, WebSockets and Server Sent Events directly in HTML, using attributes, so you can build modern user interfaces with the simplicity and power of hypertext htmx is small (~10k min.gz’d), dependency-free, extendable & IE11 … Read more

Workaround for TrackPoint mouse-cursor issues

I’m a ThinkPad user, and I have been for quite some years. One of my best arguments, is the TrackPoint, which I would argue, is missing on desktop computers. It has multiple modes such as scrolling etc. which, when used, switches the mouse cursor icon to show which mode is currently active. Though, an annoying … Read more