Refactoring the C++ has been pretty painless, for some reason C++ seems to really reward your efforts in refactoring - now nearly every line in the actual recursive methods deals with plotting the curve, with only a couple of calls to a method that tracks it and updates the internal data structures... having just recompiled and checked its just over 200 lines excluding comments. I think if it was any smaller it would start to sacrifice clarity and I plan to write C++ like my Perl - working and clear. Shame there don't seem to be any nice simple unit-testing frameworks like Test::Simple and Test::More, I have found log4cpp which will probably be added to my (currently very small) collection of essential C++ libraries.
Looking at the C++ I can see that I can probably reduce the LoC and improve the clarity and even performance (possibly) of the Perl version. I look forward to having both the C++ and Perl versions side-by-side having both been refactored.
Refactoring code in a different language forces you to look at the original in a different light, I might try and find other modules I have written in Perl and rewrite them in C++, which should improve both my Perl and C++ skills. Oddly writing more C++ means I am rereading K&R with renewed interest, hopefully I should be able to flick through Stroustrop's book with similar interest and ease after another month of two hacking with his creation.
Oh yeah - you can find them on my 'other blog'
OO (Score:2)
Re:OO (Score:2)
I assume Ruby doesn't have the 'Everything must be an object' OO puritanism of Java.
I would look at Ruby but getting up to speed on C++ is work enough and I don't see Ruby bringing in a salary anytime soon.
I plan to
@JAPH = qw(Hacker Perl Another Just);
print reverse @JAPH;
Re:OO (Score:2)
Now that you mention it, it might be interesting to see how your code looks in Java. :)
Re:OO (Score:2)
@JAPH = qw(Hacker Perl Another Just);
print reverse @JAPH;