I placed my Reverse Polish Notation (RPN) Calculator code into StackOverflow for Refactoring feedback. http://stackoverflow.com/questions/17417175/refactoring-feedback-for-reverse-polish-notation-rpn-or-postfix-notation
My biggest issue with this problem was converting the input string operators (’+’, ’-’, ’/’, ’*’) into methods I could use for mathematical calculations.
Enter the Object#send method. The Object#send function is pretty cool as it passes arguments which include a method. This can be very useful as you can pass the method as a string or symbol.
A Lookup table is pretty straight forward, it’s an array that is accessed by the program to perform a simpler computation quickly. The savings in processing time can be significant depending on the amount of data processed.
“Today is a gift, that’s why they call it the present”
Stay connected