The vocabulary frequency is too low

·

[vc_row][vc_column pl=”40″ pr=”40″ width=”1/1″][vc_column_text]

The code vocabulary frequency may be too low

[/vc_column_text][vc_btn title=”SOFTWARE ELEGANCE” style=”flat” color=”juicy-pink”][vc_btn title=”CODE COMPLEXITY” style=”outline” color=”juicy-pink”][vc_empty_space][vc_separator][vc_column_text] This code insight – a derived metric from Halstead complexity measures – evaluates if a source file has a correct level of keyword variety (i.e. the ratio between the total number of operators/operand and the number of distinct operators/operands). If this ratio is high, it means your code could be semantically poor and globally harder to understand. Depending on Halstead recommendations and thresholds defined by CAST and based on an experience of 25 years in software measurement, Highlight counts penalty points for the scanned file if the vocabulary frequency is too low.[/vc_column_text][vc_separator][vc_column_text]

Why you should care

Understanding what a piece of code is supposed to do relies on many aspects like documentation, good naming conventions, etc. The vocabulary frequency can also help developers to understand and maintain the code more easily.  Ensuring your software has a well-balanced number of different keywords that a programming language offers tends to reduce the time necessary for a developer to handle it efficiently – especially if he’s not the primary code author.[/vc_column_text][vc_column_text]

Searched Pattern

This code insight is a metric that calculate the ratio between the number of distinct words and the total number of word.

Are considered as words :

  • the identifiers
  • the keywords
  • the following operators : …, <<= >>=  != %= &= *= = -= /= = |= && || + —  ->  <<  <=  ==  >=  >>  !  %  &  *  +  ,  –  .  /  <  =  >  ?   ^  | {  ;
  • : except in a case pattern
  • ( and [ except when following an indentifier or a keyword

[/vc_column_text][vc_separator][vc_column_text]

References

https://en.wikipedia.org/wiki/Halstead_complexity_measures
http://www.virtualmachinery.com/sidebar2.htm

[vc_separator color=”grey” align=”align_center” style=”” border_width=”” el_width=””][vc_column_text pl=”0″ pr=”0″ pt=”0″ pb=”0″]

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.[/vc_column_text][vc_btn title=”SEE FEATURES & ANALYTICS” style=”flat” color=”black” link=”url:http%3A%2F%2Fcasthighlight.wpengine.com%2Foutputs-analytics%2F|||”][vc_btn title=”HOW IT WORKS” style=”outline” color=”black” link=”url:http%3A%2F%2Fcasthighlight.wpengine.com%2Fhow-it-works%2F|||”][/vc_column][/vc_row]


Leave a Reply

Your email address will not be published. Required fields are marked *