Ad
  • Custom User Avatar

    That may be better for more expensive calculations, but the beauty of this design is that it mostly doesn't matter. That change could be entirely internal to the class, with no change to the external interface. So... we don't have to make any decision about it until we've tested the performance.

  • Custom User Avatar

    I'm assuming you're referring to the choice to use a class?

    My goal was to use an object oriented approach, hiding the details of inside the object, so that the purpose becomes clear in the code. This also would allow a lot more flexibility if the rules were to change.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    Maybe I'm mistaken... but isn't it still monkey patching to reopen the class and alias a method?