Declarative Refactoring in C#

Play Declarative Refactoring in C#

The Discussion

  • User profile image

    I believe 4 factorial (4!) == (1*2*3*4) == 24 :)

    Looks like you made summation from 1..x with your code.

    Very nice presentation!

  • User profile image
    Chris Eargle

    Yes. That does illustrate another point. I named it factorial, but there was an error in the code. Either the name is incorrect and it should be corrected or the algorithm should be corrected. If the algorithm is incorrect (it is, replace + with *) it would have been caught had I properly unit tested the code.

    When I set it up before the demo, my tests were incomplete. I only tested -1, 0, and 3. Unfortunately, I received the expected results with those tests. In my demo, I used 4... of course, this gave an incorrect result.

    Thanks for the feedback, Eric!

Add Your 2 Cents