Search code examples
c#business-logic

Visualise a C# method logic


I have a complex C# method which contains a set of if statements which determine access rights for a user.

I am looking for a way to visualise this logic into, say, a workflow diagram or something similar.

This is using .NET 3.5 and Visual Studio 2010.

Which tools (preferrably freely available) are available that may do this?

NB: I have found lots of tools to visualise method calls (eg call hierarchy), this isn't what I am looking for. I am looking for a tool to visualise the logic.

Thanks

EDIT: As part of my investigation I did find Flowchart4C# but it is $200 to buy outright and the trial won't let me confirm it does what I want it to! (<5 conditional statements).


Solution

  • Refactor your method: here are some suggestions for dealing with conditionals

    http://www.refactoring.com/catalog/replaceNestedConditionalWithGuardClauses.html
    http://www.refactoring.com/catalog/replaceConditionalWithPolymorphism.html

    but probably this is best

    http://www.refactoring.com/catalog/replaceConditionalWithVisitor.html