| rule_id | 1580 |
|---|---|
| rule_category | maintainability |
| title | Write code that is easy to debug |
| severity | 2 |
Because debugger breakpoints cannot be set inside expressions, avoid overuse of nested method calls. For example, a line like:
string result = ConvertToXml(ApplyTransforms(ExecuteQuery(GetConfigurationSettings(source))));
requires extra steps to inspect intermediate method return values. On the other hard, were this expression broken into intermediate variables, setting a breakpoint on one of them would be sufficient.
Note This does not apply to chaining method calls, which is a common pattern in fluent APIs.