Nested loops can slow down innovation

InnovationSoftware EleganceCode Complexity

Nested loops can slow down innovation

This code insight detects loops within a loop (for, do, while, foreach, etc.). Depending on thresholds observed in the benchmark of thousands of applications and billions lines of code, Highlight accounts penalty points to the given scanned files.
5362

Why you should care

For code readability and performance, nested loops are frequently considered as a bad practice. In many cases, there’s a much faster and less wasteful way to accomplish the goal you’re trying to achieve.

Business Impacts

Complex code can slow down innovation

Innovation

CAST recommendations

Consider refactoring your code by avoiding the use of nested loops.

References

https://softwareengineering.stackexchange.com/questions/199196/why-are-nested-loops-considered-bad-practice

5362

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works