Got change?


This is a honest question for which, fortunately, there is an answer now.
I am sure that there was one before, but sure as well that NMoneys could not provide an answer easily.

Until now.


New features implies new version of the library and that can be obtained from Nuget itself.

From the changelog one can see that two “major” features have been added: some denomination changes corresponding to the Amendment 163 for the ISO Standard 4217 and a bunch of methods in the NMoneys..Change namespace.

Those are the really meat for the release. And if you want to know how they work, I encourage you to visit the project Wiki for an overview and the tests for deeper learning.

The complimentary background story

It’s funny how features become features in the first place. In this case, I received a spam email summary notification for some LinkedIn group I seem to be subscribed and one thing was caught by the corner of my eye: C# – Coin change problem : Greedy algorithm. The code is not particularly glorious but it sparked my curiosity. This is a answer to a problem that NMoneys could help answering.

So I did what any sane person with spare time and a OSS project could do: create a branch and TDD the feature.
I have to admit the process did not go particularly well. TDD can be painful for totally alien problems, but in the end, I had a working feature. And then I read (I should have totally started by reading about the problem, I know) and found out about canonical denomination systems, recursion and dynamic programming.

And then I was totally hooked. Dynamic programming is something that I have not come close to use since I was in the university, many moons ago.

Copy and Paste from the Interwebs with Care

A description of the problem suggested that my greedy approach could not actually give the best possible answer. It also points out to a very inefficient recursive solution. Could there be some working code out there that I can adapt to be included in NMoneys?
The key here is working. I was surprised to find that majority of code that claimed to solve the problem… It does not. At least not for the cases I had tests for. Meaning, that, sorry to say, it does not work at all. So I had to search hard to find something decent and then “trans-compile” it to C# and then tweak it. And then refactor it to not use just numbers and arrays. And then…

Get it Over it Already

But it was fun. And frustrating. I felt so bad that I was not able to come up with those clever algorithms myself. I felt I should be able  to do it. I have been trained for it. It turns out I could not. A lot of people would not admit it, but I will.
I suck at algorithmia. Big-freaking-time. I felt envious of the guys discussing improved data structures, mathematical proofs of something not working but I also felt so useless. Terribly and utterly useless. Total disgrace of a programmer.

It was a humbling experience to realize how badly you ignore things so close to what you are paid for.
The blast of getting it done in the end does not quite erase that feeling. The feeling of “it should not have been that hard”

The future

In the end I solved a couple of simple problems, but there is so much more to explore in that area. I would really, really like the community to help this one. We have a base from which grow features around. Young programmers, students,… could give a hand with something that relates to their academia background to be very valuable in this contribution.

I will create a bunch of issues with new features that I hope someone can help with.
If you know someone brainy in algorithmia with a desire to help, please let them know there is something cool to do.