Non-Nullable Types vs C#: Fixing the Billion Dollar Mistake
One of the top suggestions (currently #15 on uservoice) for improving C# is the addition of non-nullable reference types. This is not surprising, considering the number of functions that start with a...
View ArticleKeys that aren't
Today’s bug design flaw comes courtesy of Adobe. Thank you, Adobe, this series wouldn’t exist without the generous support of entities like you.
View ArticleUnfathomable Bugs: Readonly or not
Normally I post on Tuesdays, but I already have the next two posts written and this issue is too short and sweet to wait two and a half weeks. I’m actually quite surprised I haven’t stumbled on it before.
View ArticleWhen null is not enough: an option type for C#
In C# you use “null” to indicate a lack of value. This is, in a sense, both too permissive and too restrictive. I covered the “too permissive” aspect, the fact that you can’t ask for a reference that’s...
View ArticleLinq-To-Collections: Beyond IEnumerable
The latest version of the .Net framework (4.5) includes several new interfaces representing readonly collections: IReadOnlyCollection, IReadOnlyList, and IReadOnlyDictionary. In this post I’ll be...
View ArticleDecoupled Inlined UI code
When writing code to drive a user interface, there’s an unfortunate default tendency to scatter logic everywhere. At least, that’s what I do unless I apply conscious effort to avoid it. In this short...
View ArticleDecoupling Shared Control
Last week I ended on a question: how can multiple unknown components share control of something, without having to worry about trampling on each others’ toes? In this post I’ll talk about where the...
View ArticleIntroduction to Perishable Collections
Last week I talked about using lenses to decouple shared control. However, the example I gave was so simple that a “collection” of lenses could be represented with a single integer. This was on...
View ArticleImproving Checked Exceptions
The only mainstream programming language with checked exceptions (that I am aware of) is Java. Unfortunately, Java’s checked exceptions are not… ideal. Encapsulation is verbose. Doing the wrong thing...
View ArticleEmulating Actors in C# with Async/Await
The actor model is an approach to concurrency based on having small single-threaded objects (actors), that can only interact via concurrent messages (as opposed to shared state, locks, condition...
View ArticleDetermining exactly if/when/where a moving line intersected a moving point
I try to include sample projects when I publish libraries. In the case of perishable collections, the sample project was actually a simple game based on cutting lines with the mouse pointer:
View ArticleWhen One-Way Latency Doesn’t Matter
Recently, two of my coworkers started working on an MMO. Naturally, this led to discussion about networking. The discussion reminded me of a puzzle I came up with a few years ago, that changed how I...
View ArticleOptimizing Just in Time with Expression Trees
One of the steps for logging into Battle.net involves the client hashing some game files in a basic challenge-response (a.k.a. proof of knowledge) scheme referred to as the “revision check”. I...
View ArticleFollowup to Non-Nullable Types vs C#
About five months ago, I posted Non-Nullable Types vs C#: Fixing the Billion Dollar Mistake. In that post I wrote about the lack of non-nullable reference types in C#, why that was undesirable,...
View ArticleMy Bug, My Bad #2: Sunk by Float
Last week I read a post that sparked my interest: Comparing an Integer With a Floating-Point Number (Part 1, Part 2). The problem from the post is interesting because a) it involves floating point...
View ArticleMouse Path Smoothing
There are two related problems here: one is that the game is noticeably harder with a mouse than with a greasy finger, and the other is that the trail left behind a mouse can be jagged and ugly. I’m...
View ArticleIntersecting Linked Lists Faster
Yesterday, I read the post “Of intersecting linked lists” by one Paul Masurel. In it, he discusses the problem of determining the first node that is common to two linked lists. He ends with a solution...
View ArticleRule of thumb: Preconditions Should be Checked Explicitly
When I started programming, all I cared about was “does it work?”. All of the challenge was in figuring out how to achieve that. A decade and a half later, I care about more than just working/not-working.
View ArticleRule of Thumb: Ask for the Clock
The classic example is touching global mutable state, which destroys the independence between tests and introduces lots of setup and teardown concerns. Of course, global mutable state has so many other...
View ArticleTransmuting Dice, Conserving Entropy
Suppose you want to play a game of backgammon. Unfortunately, horror of horrors, you have lots of pocket change but no dice!
View Article
More Pages to Explore .....