Kael Rowan

Foundations of Elegant Code

Browse by Tags

Tagged Content List
  • Blog Post: LinkedList.FindNext and FindPrevious

    The generic collections in the .NET framework do a good job of hiding algorithmic details and instead let you focus on the purpose of a class instead of how it’s implemented.  For example, instead of using a Hashtable you use a Dictionary .  And instead of using an Array you use a List . ...
  • Blog Post: MathExtensions

    Fluent programming is cool, and with extension methods you can make your code much more elegant.  I’ve been programming for years, but I still have to squint when I see an expression like Math .Min(z, Math .Max(y, Math .Pow(x, Math .Sqrt(x)))) .  Is z the lower limit and y the upper limit? ...
  • Blog Post: System.More

    I, like most developers out there, have accumulated a set of classes and utility functions that have been used repeatedly in multiple projects throughout my career.  This code has followed me around in various forms; sometimes by copying the files directly to new projects, and other times by creating...
  • Blog Post: Comparator

    I recently wrote a generic PriorityQueue class which can treat any type of object as the priority (not just integers). Specifically, the class looked like this: public class PriorityQueue <T, TPriority> { public PriorityQueue() : this ( false ) { ... } public PriorityQueue( bool...
  • Blog Post: SynchronizationCallback

    It's common for user interface frameworks (such as Windows Forms applications or Visual Studio packages) to restrict API calls to a single thread; specifically the "UI" thread that is usually the original or "main" thread in the process. This means that if you spawn a background thread then it can't...
  • Blog Post: ThreadQueue

    I was writing an application the other day that required serializing objects to a set of files on a network share as a user is entering data. The writing is done “live” (instead of waiting until the user closes the application) because there are other applications on other computers that sync to the...
  • Blog Post: IndentedTextWriter

    There's a very useful class called IndentedTextWriter in the System.CodeDom.Compiler namespace that automatically adds whitespace before each line depending on its Indent property. This works great when you have code with several nested (or recursive) subroutines and you want them to print nested output...
  • Blog Post: PriorityQueue

    I’m implementing a single-source multiple-target version of Dijkstra's shortest path algorithm that stops when it reaches a requested number of targets.  In order to do this, I’m using a priority queue where target vertices are prioritized by shortest path weight, starting with the source. ...
Page 1 of 1 (8 items)