Code smell is any symptom in the source code of a program that possibly indicates a deeper problem. Though code smells are usually not proper bugs which are defined as technically incorrect and functionality block, they indicate poor programming practices in code level which increases risk of bugs in the future. Long method smell is identified as a kind of methods which are have large number of executable statements, at the same time God method smell is identified as a kind of methods which is doing too much. On the previous research and practice, people treat these 2 concepts equivalently. However, the definition of "large number of executable statements" shows us the size of the method, and at the same time definition of "doing too much" shows us the complexity of the logic which is implemented and nested in this method. Though intuitively the two definitions are equivalent -- methods with large number of statement means it nests much business logic so that the complexity of these methods is high, a dearth of studies suggest the research of difference between these two definitions. In this paper, present 2 research questions to study these 2 definitions. We choose one release of 11 java based web application projects which is in maintenance period respectively. In these releases, we ask the developers to analysis the bug reports and related code, then collect all 125 bugs which is caused by code smell and the related code for fixing these bugs. We get 45 bugs caused by the Long method smell and the related 31 methods, and we analyzed the data compared with the longest methods in these projects. The study highlights the need for a clearer definition of this kind of code smell, and there are many factors not only length which is affecting the code quality. So the real thing which is affecting the code quality is beyond the definition of "large number of executable statement", and at the same time the definition of "doing too much" should be modeling to illuminate this kind of code smell.
['Xiaoqiong Zhao', 'Xiao Xuan', 'Shanping Li']
An Empirical Study of Long Method and God Method in Industrial Projects