Friday, July 10, 2015

UnaryHeap: Now With Source Control

This post is just a public service announcement. Since I've been posting code snippets, and I will soon be living in two separate cities, I decided to start an open-source code repository. If you'd like to see what I'm working on at any given time, or would like to get an easy-to-import copy of some algorithm or data structure for your own projects, check me out on codeplex. Everything there is tooled for C# and the Visual Studio environment. Everything is MIT licensed, so use it as you will. I spent all of five minutes researching various open source licenses, and decided with the one that required the least work on my part.

As an inaugural release, I have checked in a skeleton implementation of the rational number class I cooked up a while back. If you want some coding practice, you could try to implement it yourself. If you do, consider the following:

  • What unit tests would you write? How thorough will they be?
  • What order will you implement the various methods and properties?
  • How might you implement the binary/text serializations? (There's more than one way to do it, as the Perl folks say, but recall that the .NET best practices say your ToString() method should be valid input for your Parse(), and your binary format on disk should be consumable from other languages.)
  • How efficient is your implementation? (ProTip: a naive implementation won't be efficient enough. You will need to leverage the oldest, most venerable algorithm in existence to keep the execution times reasonable for repeated additions/multiplications.)
  • What would you have done differently in the implementation? (Are there methods missing? Are some of the methods redundant or useless? Would you start a flame war over my choice of class versus struct?)

No comments:

Post a Comment