Why you should care
Developers tend to shorten the text required for writing code to save time and get it running. However, using short, nondescript function/variable names increases the need for excessive commenting and makes it more difficult for developers to collaborate and understand each other’s code. It also can be a source of inter-team conflict about naming conventions.
Business Impacts
Having shortened methods and identifiers makes it difficult to developers to understand what different sections of code do — this can cause an increase in collaborative development time, which in turn, leads to excess cost. Disagreements in naming convention can also be a source of conflict between team members, which impacts team effectiveness.
“Well-chosen identifiers make it significantly easier for developers and analysts to understand what the system is doing and how to fix or extend the source code to apply for new needs.”
CAST Recommendations
A unified naming convention should also be established for each programming language used, with and exact style and methodology to name variables and functions. (See reference on “Naming Convention”). This will lead to the use of more verbose and descriptive function and identifier names, which in turn will increase code readability and allow portions of code easily “self-document”. This will also reduce the effort needed for other team members to read and understand the source code.
How we detect
This code insight computes the average length of functions and identifiers encountered in the script and determines if the length is understandable.
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.