Welcome to my blog. I made it just for you.

Latest Posts

 

An Odd Case for (against?) Nullable Reference Types

I found an interesting case involving nullable reference types, the highlight feature of C# 8.

What If We Actually Did It?!

Just a fun thought I had today: generate all the GUIDs!!!

C# 8 Features I Don't Hate

I expect my readers are wondering where my continuation of the C# x Features I Don’t Like series is for version 8. Well, I’m sorry to disappoint, but I won’t be continuing that. I’m trying to make a change and be less grumpy about things. I consider it growth. Deal with it.

So instead, let’s go over the new feature set with a bit more openness and optimism. This isn’t to say that I think all of these features are amazing additions or that I’m excited about all of them, but I will be a bit more accepting of their inclusion into the language.

Changing Spaces

[copied from the old site for posterity]

So I think I’m done with WordPress. I like being able to write with Markdown. WordPress makes that difficult.

I suppose they’re catering to less techy people, and that’s fine. But it doesn’t suit me well.

So I’m going start this up again, and I’m going to do it with GitHub Pages. I might write a post about the process, but don’t hold your breath.

It’s been this long since I previously posted. A bit longer won’t hurt. I’ve already got a new one written up on my feelings regarding C# 8. It’ll be my first post on the new site.

I’ll put up a new short post here when I have the other site up.

Self-Registering APIs – Part 2: Authentication API, Registering Other Services, and Service Discovery

Today, I’ll be continuing the tour of my self-registering API architecture by taking a look at the authentication API and the mechanics of how a service registers itself. This will be a more practical dive than the previous post’s theory-heavy chit-chat.

Self-Registering APIs – Part 1: An Overview

Several months ago, I started working on a new desktop application project that was to be backed by an microservice ecosystem. I ended up designing an API where the only well-known service is the one that handles authentication, and all other services register themselves with the authentication API and only access each other via service discovery. This yields extensibility: a new service doesn’t need to be explicitly set up in the ecosystem; just add it and go.

Overriding Static Members in C#

Yeah, you read that right. We’re gonna break some rules!

Lord of the Converters

…One Converter to bring them all and in the XAML bind them…

Last time, I briefly mentioned a converter that I created for WPF that helps solve the Cambrian Explosion problem that comes with creating specialized converters. Today I’ll go over that converter and what makes it tick.

Extreme DRYness

I ran across an interesting scenario at work today that I think merits some discussion. In this post, I’ll cover what DRY is, and when following it religiously may actually cause problems.

Local Functions, At It Again

I thought I got out everything during my rant about the new C# features, but apparently I missed something…

C# 7 Features I Don't Like

It’s that time again! Time for my inner grumpy old man to come out and describe all that is wrong with the development of C# as a language!

Breaking Changes

Today we’re going to talk about breaking changes in libraries. Specifically, we’re going to answer the following:

  • What constitutes a breaking change?
  • How can I avoid making breaking changes?
  • When is a breaking change a good idea?
  • How do I indicate that a new version contains a breaking change?

They Think of Everything!

Ordinarily I like to pontificate on the merits (or detriments) of particular code design decisions. Instead today, I’d like to share a neat consequence of C# 6 that I found the other day.

A Brief Start with UWP

At work I was recently assigned to a UWP app. This post chronicles my discoveries over the first couple days.

Eliminating Hard Dependencies

You found it! After many hours of scouring the internet, you’ve finally discovered the library that does precisely what you need. Except… it has a dependency… on a package that your architect has declared unfit for your company. Your options are:

  • Persuade your architect to accept this library because you really need it (not likely)
  • Download the source and eliminate the dependency (only works if the source is available)
  • Use it anyway (not recommended as this type of behavior can result in a job search)

Today I’m not going to present a magic bullet solution to that problem. There is none. Instead we’re going to explore how to write your libraries so that you don’t put others in this horrible position.

The Importance of Error Messaging

When I was young, taking my first class in computer science, my mother told me about her experiences with computer programming coming through college in the late 70s.

We programmed with punch cards. You had to feed them into a computer to be analyzed, and if you got anything wrong, the computer output would simply be: “Error”.

Reinventing the Wheel

It’s an age-old question that just about every WPF developer has asked: How can I bind an event to a command?

Organize All the Things

I was on the train in to work this morning when an article came across my Google feed. The article is just one of many over the past few years that talk about task management tools and why Trello is inadequate, and decided that I’m tired of Trello being lumped in with apps that are specifically designed around application development and team/task management.

Hide Your Secrets

In the last post we discussed why it could be preferred to expose all of your methods publicly. However, I deliberately left something out. Some of you may have noticed.

The Case Against Private Methods

Yeah. This post is titled that.

The Disparity between APIs and SDKs

I think it’s time for us all to accept the truth: I’m abandoning the plugin series. I had a functioning proof of concept at my previous job, but I didn’t think to grab it when I left and moved halfway around the world, and I don’t feel like trying to recreate it right now. Maybe I’ll come back to it someday. Instead, today we’re going to talk about APIs and why there are so few SDKs to consume them.

A New Adventure

I’d like to apologize to my readers for my recent absence. I have been in the midst of a rather large move. As soon as we’re settled, I’ll continue the series on plugins.

Many of you know (from my hockey fandom) that I have been writing from the Dallas, Texas area. However this post is being written from my new home: Auckland, New Zealand!

An Interface by Any Other Name

We’re going to take a brief break from our series on plug-ins to explore an idea that I had regarding naming conventions, specifically interface naming in .Net.

The Cup will be with You. Always.

Well, well, well. Look who just won the Stanley Cup! Let’s take a look at the journey that brought us here.

Handling Errors from Plugins

Before we get into today’s topic, I have some sadness to report. My beloved Dallas Stars were eliminated from the NHL playoffs. Also, my favorite player, Trevor Daley, who now plays for the Pittsburgh Penguins, has suffered a broken ankle and will not be able to play in the Stanley Cup games. Happily, if they do, and the Penguins win the Cup, he’ll still get his name engraved on its holy base!

Anyway, enough of that. Let’s get on to software.

Last time we built a very simple pluggable program where each plugin provides a translation of the string Hello, World! Today, we’re going to explore some of the problems inherent in our approach.

A Plugin Primer

First of all, I’m sorry. It’s been a while. I committed to writing this blog, and I got a little lazy. That’s not to say that I haven’t been really busy, though.

Secondly, I’d like to say… LET’S GO STARS!!! (The Dallas Stars are currently in the Stanley Cup playoffs after having won the Western Conference and coming in #2 in the NHL during the regular season!)

Okay. Now that that’s out of the way, let’s get on with this blog post.


Today, we’re going to embark on a new journey: building WPF applications that support plugins. There are a number of ways to build plugable applications, and I recently had the opportunity to play around with a few ideas. In this series we’ll explore some of our options and their merits. But first, let’s look at what a plug-in is.

How to Version Assemblies Destined for Nuget

Okay. Seriously. Versioning of third-party Nuget packages has been the bane of my existence for the past week. Nuget declares that packages under its system should follow Sematic Versioning, and that’s great… for the package. But it becomes a problem when the same versioning scheme is followed for the assembly.

Architecture Always Applies

I recently ran into an issue with Nuget packages. At work, we have a private Nuget repository for code that we’d like to share across applications. It’s mostly common frameworks, like configuration and logging.

SRP (where available)

I was watching WALL-E with my children the other day… Okay, I’ll be honest. I put on WALL-E for my children the other day, then watched it with my wife while both of our kids ran around the house all crazy-like. Anyway, the movie was on, and the final scene struck a chord with me. It shows a shot of the earth with a hazy cloud of satellites surrounding it.

WPF Miller Columns, Part 2

Last time, I walked through an implementation of Miller Columns in WPF that I had posted on StackOverflow, but it ended with a few issues.

  • It was incomplete. I didn’t post the entire implementation, and much of the context was lost between then and now.
  • The implementation wasn’t very MVVM. It required a specific type to be used as a data context, whereas in MVVM proper, the view model should be completely decoupled from the view.
  • The solution required a code behind. This isn’t necessarily a bad thing, but I’d like to see if we can develop a pure-XAML solution.

Let’s get started.

WPF Miller Columns, Part 1

Today we’re going to look at a very useful UI element: Miller Columns. If you’ve ever worked in a Mac environment, you’ll probably recognize this from the Finder’s column view. In fact, Apple likes to use this mechanism throughout their operating system and within various applications. But we rarely see them (if ever) in a Windows environment. (Why is that?!)

Microsoft Did It Wrong

It’s been several years since Microsoft announced that Newtonsoft’s Json.Net would be the default JSON serializer. If you deal with JSON communication over the web at all, you probably already know this. It’s not exactly news.

However, there does seem to be a small desire among those in the web development community who would like to use alternate serializers. Personally, I’d like to use my own serializer, Manatee.Json. I originally created it out of a dissatisfaction with Json.Net, and naturally (and perhaps from some bias) think it to be superior.

WPF Animations and the Async/Await Model

I recently encountered this little gotcha at work, and thought it could benefit others, so… here you go.

The Art of Coding

We often hear about a turning a field from an art into a science, but we rarely (if ever) hear about turning a science into an art. I assure you it’s there, and I assert that one without the other is usually a horrible thing.

The Mother of Copy/Paste Errors

Sometimes, when we’re building an application, we need to run a script either before or after the build process. Fortunately, Microsoft took this need into consideration when they built Visual Studio. There, in the project properties, under Build (Compile if your one of those weird VBers), you have two multiline text boxes in which you can write your scripts: one for pre-build, and one for post-build. They even give you a button which opens a window with a scrollbar for when your script is more than three lines long. But still, something seems to be off with it. And this “something” is the primary cause of (read: what I’m blaming for) my latest computer panic/fiasco.

Manatee.Json (Part... Oops!

The last time we looked at code, we covered user-defined serialization between data models and JSON. Today, we would have reviewed auto-serialization, but I’ve hit a snag. I recently did some performance testing, and found that Manatee.Json was quite slower than its nemesis, Newtonsoft.Json (or more familiarly, Json.Net).

Goodbye, Daley. You will be missed.

We need to take a break from code for a moment to discuss another important matter. I’m going to do my best to make this not sound like an obituary, but in some ways, it feels like it should be.

Manatee.Json (Part 3: User-Defined Serialization)

In the past couple posts, we’ve looked at JSON as a language, how to represent it in code, and how to translate between JSON in a string and our object model. Now, let’s take a look at how we can make JSON work for us.

Manatee.Json (Part 2: Parsing)

We’ve been reviewing my open-source JSON library, Manatee.Json. Last time we built an object model for the language. Today, we’ll cover parsing, or converting a string with JSON content into our object model. Let’s start with a short review of the syntax.

An Introduction to Manateee.Json (Part 1: Object Model)

Today we’re going to start in on my open source JSON library, Manatee.Json. In this post, we’ll quickly review JSON as a language and build an object model.

C# 6 Features I Don't Like

There have been many posts on the features of C# 6. Probably the most thorough (however now a bit dated) I’ve seen is this one.

The Case Against Static Classes

Static classes cannot be instantiated. That means they serve only serve one purpose: providing data and functionality to all areas of an application. They are a close relative to the evil global variable.

Static WPF Converters

Most sites and books that teach WPF will tell you to declare all of your converters in XAML and then reference them using the StaticResource markup extension. I disagree. Unless you’re super-careful about it, you’ll end up creating mutliple instances of various converters.

Nulls and Extension Methods

I recently came across this blog post in which the author provides a tip on how extension methods can be used, suggesting that they can be safely used on null objects. While his suggestion is valid, I cringed at the idea because it severely hampers code readability.

Implicit Interfaces

Today’s topic is based on a question I posted on StackOverflow some time ago. There were several workarounds, but in the end, I’d still like this added as a C# feature. Since posting the question, I’ve had some time to ponder the idea a bit more, and here’s my final suggestion.

Filling the Void

Inspiration