In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to calculate and measure the ring complexity of ABAP and Java code". In daily operation, I believe that many people have doubts about how to calculate and measure the ring complexity of ABAP and Java code. Xiaobian consulted all kinds of data and sorted out simple and easy-to-use operation methods. I hope it will be helpful to answer the doubts of "how to calculate and measure the ring complexity of ABAP and Java code". Next, please follow the editor to study!
Cyclomatic complexity of code is a measure of code complexity, which was developed by Thomas J. McCabe, Sr in 1976. Put forward.
In the concept of software testing, cyclomatic complexity is used to measure the complexity of a module's decision structure, which is represented by the number of independent linear paths, that is, the minimum number of paths needed to prevent errors. The high cyclomatic complexity indicates that the program code may be of low quality and difficult to test and maintain.
Calculation formula
Ring complexity = E? N + 2
E = the number of edges in the program control flow graph
N = the number of points in the program control flow graph
Look at a specific example. The ring complexity of the following ABAP code is calculated to be 3. 5 according to the formula.
DATA: lv_value TYPE i VALUE 1.IF lv_value = 1.WRITE: / 'always happend'. ELSEIF lv_value = 2. WRITE: / 'not possible'. ELSE. WRITE: / 'even not possible'. ENDIF.
First draw the program flow diagram of the code:
Use Code inspector as a tool to measure the loop complexity of code in ABAP:
And Java can use a tool called SourceMonitor to measure ring complexity:
Refer to my blog Use SourceMonitor to monitor your java code complexity for detailed use.
At this point, the study on "how to calculate and measure the ring complexity of ABAP and Java code" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.