After a bit of thinking I thought I could make a RPN calculator, a simple program but I can still get some complexity there for fun.
Some points I want to try:
- Operators as classes, just some basic oo-programming
- Basic operators built-in, some operators loaded dynamically from dll
- Unit testing
- Refactoring
Dynamic loading of classes seems pretty simple, you just get the reference to Assembly (e.g. exe or dll) and then just look filter those classes that you are interested. getOperatorsFromAssembly function in Program.cs does the heavy lifting and is called from initOperators. Currently the only dll name is hardcoded, and a better solution would be to put all dll's in some directory and just load all of them, but I most likely won't do that.
Unit testing, Visual Studio can create test class stubs for a specific class, which is nice. Running tests is simple.
Basic refactoring, renaming and moving blocks of code to functions is straightforward.
Results can be found in github https://github.com/mika-koivusaari/rpn_calculator.
No comments:
Post a Comment