To var or not to var: how do C# developers use and misuse implicit and explicit typing?

When implicit typing with the “var” keyword was introduced into C#, it prompted contradictory opinions among developers. This paper starts by explaining the difference between implicit and explicit typing and then provides an overview of developers’ opinions and guidelines that are available online. This paper then reports on the results of a study that investigated how C# developers use and misuse implicit and explicit typing. This study involved analyzing the source code of 10 different open-source software projects including more than 16,500,000 lines of code and more than 930,000 variables. This study investigated to what extent developers use a form of typing that affects the readability of a variable’s type and the length of its declaration. It also investigated whether or not there is an adoption of a consistent set of guidelines in general and across each software project. A tool called “Code Analysis and Refactoring Engine for C#” (Care#) was developed and used to conduct the code analysis for this study.

[1]  D. E. Peercy A software maintainability evaluation methodology , 1979 .

[2]  Paulo Marques,et al.  Exception Handling: A Field Study in Java and .NET , 2007, ECOOP.

[3]  Yijun Yu,et al.  Exploring the Influence of Identifier Names on Code Quality: An Empirical Study , 2010, 2010 14th European Conference on Software Maintenance and Reengineering.

[4]  William G. Griswold,et al.  Automated assistance for program restructuring , 1993, TSEM.

[5]  Tom Mens,et al.  A survey of software refactoring , 2004, IEEE Transactions on Software Engineering.

[6]  Paul J. Deitel,et al.  Visual C# : how to program , 2016 .

[7]  Joseph Albahari C# 6.0 in a nutshell , 2015 .

[8]  Alexandre de Spindler,et al.  A Platform to Support Object Database Research , 2013, J. Object Technol..

[9]  Hiroyuki Sato,et al.  An empirical study on the effects of code visibility on program testability , 2016, Software Quality Journal.

[10]  Anas Abdin,et al.  Empirical Evaluation of the Impact of Object-Oriented Code Refactoring on Quality Attributes: A Systematic Literature Review , 2018, IEEE Transactions on Software Engineering.

[11]  Robert C. Martin Clean Code - a Handbook of Agile Software Craftsmanship , 2008 .

[12]  Claudia A. Marcos,et al.  An approach to prioritize code smells for refactoring , 2014, Automated Software Engineering.

[13]  William G. Griswold Program restructuring as an aid to software maintenance , 1992 .

[14]  Alessandro F. Garcia,et al.  How Does Exception Handling Behavior Evolve? An Exploratory Study in Java and C# Applications , 2014, 2014 IEEE International Conference on Software Maintenance and Evolution.

[15]  Rohit Gheyi,et al.  Making Program Refactoring Safer , 2010, IEEE Software.

[16]  Yijun Yu,et al.  Investigating naming convention adherence in Java references , 2015, 2015 IEEE International Conference on Software Maintenance and Evolution (ICSME).

[17]  Tibor Gyimóthy,et al.  FaultBuster: An automatic code smell refactoring toolset , 2015, 2015 IEEE 15th International Working Conference on Source Code Analysis and Manipulation (SCAM).

[18]  Andrian Marcus,et al.  Identification of high-level concept clones in source code , 2001, Proceedings 16th Annual International Conference on Automated Software Engineering (ASE 2001).

[19]  Arie van Deursen,et al.  A study and toolkit for asynchronous programming in c# , 2014, ICSE.

[20]  Emerson R. Murphy-Hill,et al.  The Reaction of Open-Source Projects to New Language Features: An Empirical Study of C# Generics , 2013, J. Object Technol..

[21]  Emerson R. Murphy-Hill,et al.  Reconciling manual and automatic refactoring , 2012, 2012 34th International Conference on Software Engineering (ICSE).

[22]  Bennet P. Lientz,et al.  Software Maintenance Management: A Study of the Maintenance of Computer Application Software in 487 Data Processing Organizations , 1980 .

[23]  Markus Pizka,et al.  Concise and consistent naming , 2005, 13th International Workshop on Program Comprehension (IWPC'05).

[24]  Roman Senkerik,et al.  Towards an Empirical Analysis of .NET Framework and C# Language Features' Adoption , 2015, 2015 International Conference on Computational Science and Computational Intelligence (CSCI).

[25]  Nélio Cacho,et al.  Do android developers neglect error handling? a maintenance-Centric study on the relationship between android abstractions and uncaught exceptions , 2018, J. Syst. Softw..

[26]  Danny Dig,et al.  How do developers use parallel libraries? , 2012, SIGSOFT FSE.

[27]  Alessandro F. Garcia,et al.  Trading robustness for maintainability: an empirical study of evolving c# programs , 2014, ICSE.

[28]  David W. Binkley,et al.  Quantifying identifier quality: an analysis of trends , 2006, Empirical Software Engineering.

[29]  Andrew P. Black,et al.  Refactoring Tools: Fitness for Purpose , 2008, IEEE Software.

[30]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[31]  Romain Robbes,et al.  How (and why) developers use the dynamic features of programming languages: the case of smalltalk , 2012, Empirical Software Engineering.

[32]  Sanjay Kumar Dubey,et al.  Comparative Study of the Factors that Affect Maintainability , 2011 .

[33]  Khairuddin Hashim,et al.  A SOFTWARE MAINTAINABILITY ATTRIBUTES MODEL , 1970 .

[34]  David W. Binkley,et al.  Source Code Analysis: A Road Map , 2007, Future of Software Engineering (FOSE '07).

[35]  Paul W. Oman,et al.  Using metrics to evaluate software system maintainability , 1994, Computer.