Do you know when functions are too complicated?
Last updated by Lee Hawkins [SSW] over 1 year ago.See historyYou should generally be looking for ways to simplify your code (e.g. removing heavily-nested case statements). As a minimum, look for the most complicated method you have and check whether it needs simplifying.
In Visual Studio, there is built-in support for Cyclomatic Complexity analysis.
- Go to Analyze | Calculate Code Metrics | For Solution
- Look at the function with the largest Cyclomatic Complexity number and consider refactoring to make it simpler.
Tip: Aim for "green" against each function's Maintainability Index.
Love it
0
Agree
0
Disagree
0
No way
0