Reverse Double Linked List in C#

This is a question that often comes up in an interview. The solution is simple. To begin with, initialise three node references: current points to the head node previous points to null next points to null Remember to point the tail to the head before we begin: tail = head; Now, iterate over the nodes […]

XMPP Progress

The XMPP Component framework is coming on nicely. It can connect and send/receive messages: Using C# again is a joy. I absolutely love the dynamic capabilities. For example, in this factory method, Ping is dynamically added – it is not a property: Which produces the following XML: Eventually Ping will be its own subpacket, but […]

C# Null! Tip

C# 8.0 introduced non-nullable reference types. I use them because it is considered best practice. I first encountered them in Kotlin. But I’m not a huge fan because they: have a cascading effect on interfaces and code are often not very helpful Monkey Business On the first problem, there are cases where things might be […]

Enums and Literals

One of the things I love about C# is reflection. Because of assemblies and metadata, and an excellent supporting framework, it is very easy to take advantage of this paradigm. This week I threw myself into building an XMPP component framework from scratch. The first objective is to get the plumbing and architecture in place. […]

Concise C# Property Name

When constructing XML elements, it’s nice to have a concise API. One of the features I’m implementing is the ability to easily move up to a parent element. There’s no cascade operator in C#, like you see in Dart. Whilst exploring options, I found this works: Example usage: I thought that was interesting – albeit […]

Result or no Result

Recently I spent a couple of hours building a few classes to support some functional programming constructs in C#. At the end of the experiment, doubts have me backing out mostly. In certain use cases, the new constructs are a nice fit, but they can easily be overused. And their usage has a cascading effect […]

Activator.CreateInstance

One thing I love about using C# is reflection, it adds another paradigm to the toolkit. Recently, I revisited my old friend Activator.CreateInstance which is perfect for scenarios where you want to use generic code to create and initialize specific types of objects. Basic Example Some time ago, I wrote a simple application which plugs […]

Doxygen for C# and C++

Doxygen is a cross platform open source code documentation tool which I’ve used for both Visual C++ and C# .NET projects. It produces awesome documentation and is very easy to use. Configuration is straight forward using DoxyWizard. Doxygen can be configured to use Graphviz to produce call and dependency graphs. After installing Graphiz you’ll need […]

C++ ORM DSL via Macros

Macros, like the goto statement, have become somewhat frowned upon nowadays, but (IMO) I think that’s a little excessive. Macros, used judiciously, can be beneficial. For example, you may want code to execute in debug but not release, you can define the symbol accordingly and avoid hundreds of #ifdef’s throughout your codebase. Arguably, you could […]

NDepend – A Developer’s Best Friend

Creating a Mess Recently I began work on an XMPP Component Framework in C#, initially trying to reuse code from a previous version. I’m trying to do it right this time, conforming to the official specifications. This has led to a lot of rework as the previous version was essentially based upon code I’d written […]