Applying coupling and cohesion concepts in object-oriented software: a controlled experiment
Context: Coupling and cohesion concepts support the object-oriented (OO) design activity. A better design implies less coupled and more cohesive classes. Thus, it is expected studies on OO design investigate issues impacting the good application of these concepts. However, most studies in the area have focused on high-level metaphors, such as code smells and design patterns; or software metrics. Objective: This study aims to build empirical evidence reinforcing that basic concepts deserve more attention towards better OO design. The study investigates the application of coupling and cohesion concepts during programming activity. Two topics are addressed: i) how developer characteristics (“previous knowledge on the concepts” and “developers experience”) impact on software design during programming activity; and ii) the differences in applying the concepts, independently. Method: A quasi-experiment with 17 participants. The participants were graduate and undergraduate students, but all have professional experience in software development. The software they programmed was compared with the experiment's oracle in terms of the application of coupling and cohesion concepts. Result: One finding is previous knowledge on the concepts impacts on design quality, in some way; while developers experience doesn't. Another finding is: application of cohesion is significantly easier than application of coupling. Conclusion: A conjecture based on these findings is training on basic OO principles (including formal education) might be more relevant than developer experience towards better software design. At last, the topic needs more investigation. We suggest this approach brings a complementary perspective of analysis to discuss the topic.