Short code identifiers are harder to understand

Short code identifiers are harder to understand

Software AgilityEmbedded Documentation

This code insight counts the number of code identifiers (such as class, function, method, attribute names, etc.) whose length is lower than a predefined number of characters for each technology. Depending on the density of these short identifiers vs. all identifiers, Highlight counts penalty points for the given file.

Why you should care

Have you ever attended a meeting where everybody continuously talks with acronyms and you don’t have a clue on what they’re referring to?  It’s very similar with short code identifiers. A method should textually indicate what it does (e.g. getLatestCustomerOrders instead of getLCO, deleteMyHardDrive instead of delete_MHD) to help developers understand the code as they naturally think. Having a self-explanatory artifact name tends to reduce maintenance effort, and can help to avoid mistakes.

CAST recommendations

Ensure your artifact names describe what they are or what they do – otherwise rename them. Modern IDEs automate renaming of artifact names and propagates this change across your software.

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.

How it worksFeatures & Analytics