Programming Pearls : Sorting Phone Numbers

Revisiting a Classic Book I’m re-reading Programming Pearls by Jon Bentley. I read this book within a year or two of its release, early in my career. That was 16 or 17 years ago. I remember enjoying it greatly. It opened my eyes to the critical importance of selecting optimal data structures and algorithms when designing solutions to programming problems. The author advocates for deliberation prior to putting hands on the keyboard. Re-reading the book now as a more experienced (and I would hope wiser) programmer, I’m reminded of a quote from Linus Torvalds. What Jon Bentley states in elegant […]

Searchable Source Code in WordPress

I embed source code in blog posts using GitHub Gists. Gists provide provide many benefits, including a live view of the code (update code in Gist, code is updated in blog post), syntax highlighting, line numbers (useful if readers have questions or comments about the code), scroll bars, and links to access source code in GitHub repository or the raw plaintext code. One problem that occurs when embedding source code via Gists is the code is not indexed by the WordPress search engine. Therefore, searching for a class name or namespace will not find all blog posts that reference the […]

Revert Visual Studio 2019 Syntax Highlighting Colors to 2017 Colors

Years ago there was a TV news anchor in Chicago that had a habit of emphasizing every single WORD! I was annoyed by her delivery because, of course, emphasizing every word is the same as emphasizing no words. Only much more tedious. I feel Visual Studio 2019 commits the same sin with its additional syntax highlighting colors. I’m sorry, that’s just too many words emphasized with too many colors. Visual Studio provides numerous ways to determine syntactical meaning of code words, such as a tooltip window that appears when hovering the mouse cursor over a word, F12 navigation to variable […]

Async Does Not Imply Concurrent

I wish authors who write articles about C# async / await programming techniques would emphasize that two concepts they frequently discuss are actually separate features that provide separate benefits. Perhaps I’ve overlooked an explanation of the orthogonality of async and concurrent in the restaurant or cooking breakfast analogies. (Update 2020 Jul 30: The cooking breakfast article has been updated and draws a clearer distinction between async work and parallel / concurrent work). Nonetheless, it will benefit readers of this blog to disentangle the concepts here. It’s easy for novice programmers to write incorrect code and believe they’re getting performance benefits […]

The Best Domain-Specific Language for Manipulating Data is SQL

Motivation I’m not a fan of Microsoft’s Language Integrated Query (LINQ). But ranting about a language feature is an ineffective way to convince programmers of the merits of other techniques. So decided to construct a detailed example that illustrates how LINQ solves a certain problem, contrast it with a different technique, then highlight the deficiencies of LINQ and extol the virtues of my preferred technique. I happily set about creating a relational database and C# object model, then hit an impasse. When the time came to determine how to write LINQ code that maps the relational data into the C# […]