Just a quick update on a small side project that I recently completed.
It started out as a test driven development code kata which involved implementing the classic shunting-yard algorithm by Edsger Dijkstra as well as a basic RPN evaluator. Additions to the basic algorithms includes support for named variables, a constants, and conversion of infix expressions to rpn.
The end result is a simple calculator for the windows desktop, written in WPF/C# for the .NET 4 platform, which allows you to input complete mathematical expressions in either infix or postfix (rpn) notation. It is designed to be easy to use by minimizing the use of settings and mode toggles. It will for example automatically detect if what you have entered is in infix or postfix notation.
As with all my utility side project the main goal was to create something that I would like to use myself. I have annoyed myself at the built in desktop calculator for some time while other more able calculators I have tried have seemed like overkill for my needs.
The unit tests written during development have been a real boon in that every time an error was discovered I would just add the offending expression to the tests and work through the code until the problem was resolved. Re-running all the tests then verifies that nothing else was broken in the process. This would have been a much more laborious and error prone process had the test scaffolding not been in place. Examples such as this just reaffirms my
conviction that unit tests are indispensible for maintaining code quality and correctness.
Note: As is always the case with experimental software such as this I give no guarantee that it will always perform correctly (so please don’t use it for anything critical).
If you discover that the calculator returns something unexpected or plain wrong then don’t hesitate to leave me a comment to tell me about it.
If you are interested in trying it out you can download it here: Calcium 18.104.22.168