On the comprehensibility of functional decomposition: An empirical studyICPCICPC RENE Paper
Folk-wisdom in software engineering suggests that small functions that adhere to the principle of single-responsibility have several advantages over longer, monolithic functions, including improvement in code comprehension. Despite this widespread view, empirical research on the impact of functional decomposition on understanding code is sparse, yet it is central to software development practices.
In this study, we investigated the impact of functional decomposition on understanding using a controlled experiment in which participants were tasked with comprehending code for two different functionalities, each implemented as either a single function or multiple functions, and recorded the reading time, code description accuracy, and behaviour question responses.
Despite a carefully constructed empirical study, we find that the influence of function decomposition on code understanding is inconclusive, suggesting that functional decomposition does not universally enhance code comprehensibility, and context-aware guidelines for code structuring may promote better comprehensibility. Our negative result contributes to the ongoing refinement of software engineering best practices for creating more maintainable software.