Declarative Refactoring in C#

Play Declarative Refactoring in C#
Sign in to queue

Description

You will learn how to fully utilize the C# language to assign functionality where it belongs, make your code readable even for that future you, and in the process end up with a reusable framework.

Day:

2

Level:

300

Code:

Devdays063

Embed

Download

Download this episode

The Discussion

  • User profile image
    Eric

    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