A metrics-based comparative study on object-oriented programming languages

There has been a long debate on which programming language can help write better object-oriented programs. However, to date little response is given to this issue with empirical evidence. In this paper, we perform a comparative study on C++, C#, and Java programs by using object-oriented metrics, which comprise measures for class size, complexity, coupling, cohesion, inheritance, encapsulation, polymorphism, and reusability. Our experiment is conducted on 78 tasks in Rosetta Code, a code repository providing solutions to the same programming tasks in different languages. The experimental results show that: (1) C++ classes are significantly larger than C# and Java classes in size, but their complexity does not differ significantly; (2) C# classes are significantly more likely to be coupled than C++ and Java classes through inter-class method invocations instead of direct data access; (3) C# and Java classes tend to be more cohesive than C++ classes; (4) C# and Java significantly outperform C++ in building deep inheritance trees; and (5) programs written in C++, C#, and Java do not show a significant difference in class encapsulation, polymorphism, and reusability. These findings could help practitioners choose suitable languages to develop object-oriented systems. 1 KeywordsProgramming Language, Comparative Study, Objectoriented Metrics

[1]  Chris F. Kemerer,et al.  A Metrics Suite for Object Oriented Design , 2015, IEEE Trans. Software Eng..

[2]  Mohammad Alshayeb,et al.  Using Software Quality Attributes to Classify Refactoring to Patterns , 2012, J. Softw..

[3]  Yuming Zhou,et al.  Source code size estimation approaches for object-oriented systems from UML class diagrams: A comparative study , 2014, Inf. Softw. Technol..

[4]  K. K. Aggarwal,et al.  Empirical Study of Object-Oriented Metrics , 2006, J. Object Technol..

[5]  Lefteris Angelis,et al.  A large-scale empirical study of practitioners' use of object-oriented concepts , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[6]  Lionel C. Briand,et al.  A Unified Framework for Cohesion Measurement in Object-Oriented Systems , 1997, Proceedings Fourth International Software Metrics Symposium.

[7]  Lutz Prechelt,et al.  An Empirical Comparison of Seven Programming Languages , 2000, Computer.

[8]  Brian Henderson-Sellers,et al.  Object-Oriented Metrics , 1995, TOOLS.

[9]  Richard H. Carver,et al.  An Evaluation of the MOOD Set of Object-Oriented Software Metrics , 1998, IEEE Trans. Software Eng..

[10]  Premkumar T. Devanbu,et al.  A large scale study of programming languages and code quality in github , 2014, SIGSOFT FSE.

[11]  Lionel C. Briand,et al.  A systematic and comprehensive investigation of methods to build and evaluate fault prediction models , 2010, J. Syst. Softw..

[12]  Sucheta Bhasin,et al.  Application of Object-Oriented Metrics To C++ and Java: A Comparative Study , 2011, SOEN.

[13]  Magiel Bruntink,et al.  Predicting class testability using object-oriented metrics , 2004 .

[14]  Arie van Deursen,et al.  Predicting class testability using object-oriented metrics , 2004, Source Code Analysis and Manipulation, Fourth IEEE International Workshop on.

[15]  Carlo A. Furia,et al.  A Comparative Study of Programming Languages in Rosetta Code , 2014, 2015 IEEE/ACM 37th IEEE International Conference on Software Engineering.

[16]  Leo A. Meyerovich,et al.  Empirical analysis of programming language adoption , 2013, OOPSLA.

[17]  Tibor Gyimóthy,et al.  Empirical validation of object-oriented metrics on open source software for fault prediction , 2005, IEEE Transactions on Software Engineering.