Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/2597008.2597140acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
Article

On the effect of code regularity on comprehension

Published: 02 June 2014 Publication History

Abstract

It is naturally easier to comprehend simple code relative to complicated code. Regrettably, there is little agreement on how to effectively measure code complexity. As a result simple generalpurpose metrics are often used, such as lines of code (LOC), Mc- Cabe’s cyclomatic complexity (MCC), and Halstead’s metrics. But such metrics just count syntactic features, and ignore details of the code’s global structure, which may also have an effect on understandability. In particular, we suggest that code regularity—where the same structures are repeated time after time—may significantly reduce complexity, because once one figures out the basic repeated element it is easier to understand additional instances. We demonstrate this by controlled experiments where subjects perform cognitive tasks on different versions of the same basic function. The results indicate that versions with significant regularity lead to better comprehension, while taking similar time, despite being longer and having higherMCC. These results indicate that regularity is another attribute of code that should be taken into account in the context of studying the code’s complexity and comprehension. Moreover, the fact that regularity may compensate for LOC and MCC demonstrates that complexity cannot be decomposed into independently addable contributions by individual attributes.

References

[1]
V. Arunachalam and W. Sasso, “ Cognitive processes in program comprehension: An empirical analysis in the context of software reengineering”. J. Syst. & Softw. 34(3), pp. 177––189, Sep 1996.
[2]
P. Bame, “ McCabe-style function complexity”. URL http://parisc-linux.org/ bame/pmccabe/overview.html.
[3]
V. Basili and R. Selby, “ Comparing the effectiveness of software testing strategies”. IEEE Trans. Softw. Eng. SE-13(12), pp. 1278–1296, 1987.
[4]
N. Bettenburg, M. Nagappan, and A. E. Hassan, “ Think locally, act globally: Improving defect and effort prediction models”. In 9th Intl. Workshop Mining Softw. Repositories, pp. 60–69, Jun 2012.
[5]
D. Beyer and A. Fararooy, “ A simple and effective measure for complex low-level dependencies”. In 18th IEEE Intl. Conf. Program Comprehension, pp. 80–83, 2010.
[6]
B. Chaudhary and H. Sahasrabuddhe, “ Two dimensions of program comprehension”. Intl. J. Man-Machine Studies 18(5), pp. 505–511, 1983.
[7]
B. Cornelissen, A. Zaidman, and A. van Deursen, “ A controlled experiment for program comprehension through trace visualization”. IEEE Trans. Softw. Eng. 37(3), pp. 341 –355, May-June 2011.
[8]
B. Curtis, J. Sappidi, and J. Subramanyam, “ An evaluation of the internal quality of business applications: Does size matter? ” In 33rd Intl. Conf. Softw. Eng., pp. 711–715, May 2011.
[9]
G. Denaro and M. Pezzè, “ An empirical evaluation of fault-proneness models”. In 24th Intl. Conf. Softw. Eng., pp. 241–251, May 2002.
[10]
J. Elshoff, “ An analysis of some commercial PL/I programs”. IEEE Trans. Softw. Eng. SE-2(2), pp. 113–120, 1976.
[11]
J. Feigenspan, S. Apel, J. Liebig, and C. Kastner, “ Exploring software measures to assess program comprehension”. In Empirical Software Engineering and Measurement (ESEM), 2011 International Symposium on, pp. 127–136, Sept 2011.
[12]
N. E. Fenton and S. L. Pfleeger, Software Metrics: A Rigorous and Practical Approach. Course Technology, 2nd ed., 1998.
[13]
M. Fisher, A. Cox, and L. Zhao, “ Using sex differences to link spatial cognition and program comprehension”. In 22nd Intl. Conf. Softw. Maintenance, pp. 289–298, 2006.
[14]
M. Halstead, Elements of Software Science. Elsevier Science Inc., 1977.
[15]
J. Harder and R. Tiarks, “ A controlled experiment on software clones”. In 20th IEEE Intl. Conf. Program Comprehension, pp. 219–228, 2012.
[16]
P. Jablonski and D. Hou, “ Aiding software maintenance with copy-and-paste clone-awareness”. In Program Comprehension (ICPC), 2010 IEEE 18th International Conference on, pp. 170–179, June 2010.
[17]
A. Jbara and D. G. Feitelson, “ Quantification of code regularity using preprocessing and compression”. manuscript, Jan 2014.
[18]
A. Jbara, A. Matan, and D. G. Feitelson, “ High-MCC functions in the Linux kernel ”. Empirical Softw. Eng. 2013. Accepted for publication.
[19]
N. Juristo, S. Vegas, M. Solari, S. Abrahao, and I. Ramos, “ Comparing the effectiveness of equivalence partitioning, branch testing and code reading by stepwise abstraction applied by subjects”. In 5th IEEE Intl. Conf. Software Testing, Verification and Validation, pp. 330–339, 2012.
[20]
C. J. Kasper and M. W. Godfrey, “ “Cloning considered harmful” considered harmful: Patterns of cloning in software”. Empirical Softw. Eng. 13(6), pp. 645–692, Dec 2008.
[21]
B. Katzmarski and R. Koschke, “ Program complexity metrics and programmer opinions”. In 20th IEEE Intl. Conf. Program Comprehension, Jun 2012.
[22]
J. L. Krein, L. Pratt, A. Swenson, A. MacLean, C. D. Knutson, and D. Eggett, “ Design patterns in software maintenance: An experiment replication at brigham young university”. In 2nd Intl. Workshop Replication in Empirical Software Engineering Research, pp. 25–34, 2011.
[23]
Z. Li, S. Lu, S. Myagmar, and Y. Zhou, “ CP-Miner: A tool for finding copy-paste and related bugs in operating system code”. In 6th Symp. Operating Systems Design & Implementation, pp. 289––302, Dec 2004.
[24]
H. Lipson, “ Principles of modularity, regularity, and hierarchy for scalable systems”. Journal of Biological Physics and Chemistry 7(4), pp. 125–128, 2007.
[25]
A. Lozano, A. Kellens, K. Mens, and G. Arevalo, “ Mining source code for structural regularities”. In 17th Working Conf. Reverse Engineering, pp. 22–31, Washington, DC, USA, 2010.
[26]
J. Mayrand, C. Leblanc, and E. M. Merlo, “ Experiment on the automatic detection of function clones in a software system using metrics”. In Intl. Conf. Softw. Maintenance, pp. 244–253, Nov 1996.
[27]
T. McCabe, “ A complexity measure”. IEEE Trans. Softw. Eng. 2(4), pp. 308–320, Dec 1976.
[28]
T. Menzies, A. Butcher, D. Cok, A. Marcus, L. Layman, F. Shull, B. Turhan, and T. Zimmermann, “ Local versus global lessons for defect prediction and effort estimation”. IEEE Trans. Softw. Eng. 39(6), pp. 822–834, Jun 2013.
[29]
T. Menzies, J. Greenwald, and A. Frank, “ Data mining code attributes to learn defect predictors”. IEEE Trans. Softw. Eng. 33(1), pp. 2–13, Jan 2007.
[30]
MSDN Visual Studio Team System 2008 Development Developer Center, “ Avoid excessive complexity”. URL msdn.microsoft.com/en-us/library/ms182212.aspx, undated. (Visited 23 Dec 2009).
[31]
N. Nagappan and T. Ball, “ Static analysis tools as early indicators of pre-release defect density”. In 27th Intl. Conf. Softw. Eng., pp. 580–586, May 2005.
[32]
N. Nagappan, T. Ball, and A. Zeller, “ Mining metrics to predict component failures”. In 28th Intl. Conf. Softw. Eng., pp. 452–461, May 2006.
[33]
B. A. Nejmeh, “ Npath: a measure of execution path complexity and its applications”. Comm. ACM 31(2), pp. 188–200, Feb 1988.
[34]
N. Ohlsson and H. Alberg, “ Predicting fault-prone software modules in telephone switches”. IEEE Trans. Softw. Eng. 22(12), pp. 886–894, Dec 1996.
[35]
P. Oman and J. Hagemeister, “ Construction and testing of polynomials predicting software maintainability”. J. Syst. & Softw. 24(3), pp. 251––266, Mar 1994.
[36]
M. Pacione, M. Roper, and M. Wood, “ A novel software visualisation model to support software comprehension”. In 11th Working Conf. Reverse Engineering, pp. 70–79, 2004.
[37]
D. Pierret and D. Poshyvanyk, “ An empirical exploration of regularities in open-source software lexicons”. In 17th IEEE Intl. Conf. Program Comprehension, pp. 228–232, 2009.
[38]
J. Rilling and T. Klemola, “ Identifying comprehension bottlenecks using program slicing and cognitive complexity metrics”. In Program Comprehension, 2003. 11th IEEE International Workshop on, pp. 115 – 124, may 2003.
[39]
J. Shao and Y. Wang, “ A new measure of software complexity based on cognitive weights”. Canadian J. Electrical and Comput. Eng. 28(2), pp. 69 –74, april 2003.
[40]
M. Shepperd, “ A critique of cyclomatic complexity as a software metric”. Software Engineering J. 3(2), pp. 30–36, Mar 1988.
[41]
B. Shneiderman, “ Measuring computer program quality and comprehension”. Intl. J. Man-Machine Studies 9(4), July 1977.
[42]
E. Soloway and K. Ehrlich, “ Empirical studies of programming knowledge”. IEEE Trans. Softw. Eng. SE-10(5), pp. 595–609, Sep 1984.
[43]
SRI, “ Software technology roadmap: Cyclomatic complexity”. In URL www.sei.cmu.edu/str/str.pdf, 1997. (Visited 28 Dec 2008).
[44]
I. Stamelos, L. Angelis, A. Oikonomou, and G. L. Bleris, “ Code quality analysis in open source software development ”. Inf. Syst. J. 12(1), pp. 43–60, Jan 2002.
[45]
VerifySoft Technology, “ McCabe metrics”. URL www.verifysoft.com/en_mccabe_metrics.html, Jan 2005. (Visited 23 Dec 2009).
[46]
J. J. Vinju and M. W. Godfrey, “ What does control flow really look like? Eyeballing the cyclomatic complexity metric”. In 12th Working Conf. Source Code Analysis and Manipulation, Sep 2012.
[47]
K. D. Welker, P. W. Oman, and G. G. Atkinson, “ Development and application of an automated source code maintainability index”. J. Softw. Maintenance 9(3), pp. 127–159, May 1997.
[48]
S. Xu, “ A cognitive model for program comprehension”. In 3rd ACIS Intl. Conf. Softw. Eng. Research, Management, & Apps., pp. 392––398, Aug 2005.
[49]
H. Zhang, “ Exploring regularity in source code: Software science and Zipf’s law”. In 15th Working Conf. Reverse Engineering, pp. 101–110, 2008.
[50]
J. Zhao, N. Al-Aidroos, and N. B. Turk-Browne, “ Attention is spontaneously biased toward regularities”. Psychological Sci. 24(5), pp. 667–677, May 2013.
[51]
J. Ziv and A. Lempel, “ A universal algorithm for sequential data compression”. IEEE Trans. Information Theory IT-23(3), pp. 337–343, May 1977.

Cited By

View all
  • (2024)Exploring the Impact of Source Code Linearity on the Programmers' Comprehension of API Code ExamplesProceedings of the 32nd IEEE/ACM International Conference on Program Comprehension10.1145/3643916.3644395(236-240)Online publication date: 15-Apr-2024
  • (2024)Custom static analysis to enhance insight into the usage of in-house librariesJournal of Systems and Software10.1016/j.jss.2024.112028212:COnline publication date: 1-Jun-2024
  • (2023)From Code Complexity Metrics to Program ComprehensionCommunications of the ACM10.1145/354657666:5(52-61)Online publication date: 21-Apr-2023
  • Show More Cited By

Index Terms

  1. On the effect of code regularity on comprehension

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ICPC 2014: Proceedings of the 22nd International Conference on Program Comprehension
    June 2014
    325 pages
    ISBN:9781450328791
    DOI:10.1145/2597008
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    In-Cooperation

    • TCSE: IEEE Computer Society's Tech. Council on Software Engin.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 02 June 2014

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. Code regularity
    2. LOC
    3. MCC
    4. code complexity

    Qualifiers

    • Article

    Conference

    ICSE '14
    Sponsor:

    Upcoming Conference

    ICSE 2025

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)29
    • Downloads (Last 6 weeks)3
    Reflects downloads up to 09 Nov 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Exploring the Impact of Source Code Linearity on the Programmers' Comprehension of API Code ExamplesProceedings of the 32nd IEEE/ACM International Conference on Program Comprehension10.1145/3643916.3644395(236-240)Online publication date: 15-Apr-2024
    • (2024)Custom static analysis to enhance insight into the usage of in-house librariesJournal of Systems and Software10.1016/j.jss.2024.112028212:COnline publication date: 1-Jun-2024
    • (2023)From Code Complexity Metrics to Program ComprehensionCommunications of the ACM10.1145/354657666:5(52-61)Online publication date: 21-Apr-2023
    • (2023)A systematic literature review on the impact of formatting elements on code legibilityJournal of Systems and Software10.1016/j.jss.2023.111728203:COnline publication date: 13-Jul-2023
    • (2022)CausetteProceedings of the 30th IEEE/ACM International Conference on Program Comprehension10.1145/3524610.3527885(241-252)Online publication date: 16-May-2022
    • (2022)Considerations and Pitfalls for Reducing Threats to the Validity of Controlled Experiments on Code ComprehensionEmpirical Software Engineering10.1007/s10664-022-10160-327:6Online publication date: 23-Jun-2022
    • (2021)Considerations and Pitfalls in Controlled Experiments on Code Comprehension2021 IEEE/ACM 29th International Conference on Program Comprehension (ICPC)10.1109/ICPC52881.2021.00019(106-117)Online publication date: May-2021
    • (2021)Understanding large-scale software systems – structure and flowsEmpirical Software Engineering10.1007/s10664-021-09938-826:3Online publication date: 31-Mar-2021
    • (2020)A Human Study of Comprehension and Code SummarizationProceedings of the 28th International Conference on Program Comprehension10.1145/3387904.3389258(2-13)Online publication date: 13-Jul-2020
    • (2020)Do Programmers Prefer Predictable Expressions in Code?Cognitive Science10.1111/cogs.1292144:12Online publication date: 12-Dec-2020
    • Show More Cited By

    View Options

    Get Access

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media