Skip to main content
Erschienen in: Software Quality Journal 3/2019

16.11.2018

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

verfasst von: Pierre A. Akiki

Erschienen in: Software Quality Journal | Ausgabe 3/2019

Einloggen

Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.

search-config
loading …

Abstract

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.

Sie haben noch keine Lizenz? Dann Informieren Sie sich jetzt über unsere Produkte:

Springer Professional "Wirtschaft"

Online-Abonnement

Mit Springer Professional "Wirtschaft" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 340 Zeitschriften

aus folgenden Fachgebieten:

  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Versicherung + Risiko




Jetzt Wissensvorsprung sichern!

Springer Professional "Wirtschaft+Technik"

Online-Abonnement

Mit Springer Professional "Wirtschaft+Technik" erhalten Sie Zugriff auf:

  • über 102.000 Bücher
  • über 537 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Finance + Banking
  • Management + Führung
  • Marketing + Vertrieb
  • Maschinenbau + Werkstoffe
  • Versicherung + Risiko

Jetzt Wissensvorsprung sichern!

Springer Professional "Technik"

Online-Abonnement

Mit Springer Professional "Technik" erhalten Sie Zugriff auf:

  • über 67.000 Bücher
  • über 390 Zeitschriften

aus folgenden Fachgebieten:

  • Automobil + Motoren
  • Bauwesen + Immobilien
  • Business IT + Informatik
  • Elektrotechnik + Elektronik
  • Energie + Nachhaltigkeit
  • Maschinenbau + Werkstoffe




 

Jetzt Wissensvorsprung sichern!

Literatur
Zurück zum Zitat Al Dallal, J., & Abdin, A. (2018). Empirical evaluation of the impact of object-oriented code refactoring on quality attributes: a systematic literature review. IEEE Transactions on Software Engineering, 44(1), 44–69.CrossRef Al Dallal, J., & Abdin, A. (2018). Empirical evaluation of the impact of object-oriented code refactoring on quality attributes: a systematic literature review. IEEE Transactions on Software Engineering, 44(1), 44–69.CrossRef
Zurück zum Zitat Albahari, J., & Albahari, B. (2016). C# 6.0 in a nutshell. Oreilly. Albahari, J., & Albahari, B. (2016). C# 6.0 in a nutshell. Oreilly.
Zurück zum Zitat Binkley, D. (2007). Source code analysis: a road map. in: Future of software engineering, 2007. FOSE’07. IEEE, pp. 104–119. Binkley, D. (2007). Source code analysis: a road map. in: Future of software engineering, 2007. FOSE’07. IEEE, pp. 104–119.
Zurück zum Zitat Butler, S., Wermelinger, M., Yu, Y., & Sharp, H. (2010). Exploring the influence of identifier names on code quality: an empirical study. In Software maintenance and reengineering (CSMR), 2010 14th European Conference On. IEEE, pp. 156–165. Butler, S., Wermelinger, M., Yu, Y., & Sharp, H. (2010). Exploring the influence of identifier names on code quality: an empirical study. In Software maintenance and reengineering (CSMR), 2010 14th European Conference On. IEEE, pp. 156–165.
Zurück zum Zitat Butler, S., Wermelinger, M., & Yu, Y. (2015). Investigating naming convention adherence in Java references. In Software maintenance and evolution (ICSME), 2015 IEEE International Conference On. IEEE, pp. 41–50. Butler, S., Wermelinger, M., & Yu, Y. (2015). Investigating naming convention adherence in Java references. In Software maintenance and evolution (ICSME), 2015 IEEE International Conference On. IEEE, pp. 41–50.
Zurück zum Zitat Cabral, B., & Marques, P. (2007). Exception handling: a field study in Java and NET. In: E. Ernst, (Ed.), ECOOP 2007—object-oriented programming: 21st European conference, Berlin, Germany, July 30–august 3, 2007. Proceedings. Springer: Berlin, pp. 151–175. https://doi.org/10.1007/978-3-540-73589-2_8. Cabral, B., & Marques, P. (2007). Exception handling: a field study in Java and NET. In: E. Ernst, (Ed.), ECOOP 2007—object-oriented programming: 21st European conference, Berlin, Germany, July 30–august 3, 2007. Proceedings. Springer: Berlin, pp. 151–175. https://​doi.​org/​10.​1007/​978-3-540-73589-2_​8.
Zurück zum Zitat Cacho, N., Barbosa, E. A., Araujo, J., Pranto, F., Garcia, A., Cesar, T., Soares, E., Cassio, A., Filipe, T., & Garcia, I. (2014a). How does exception handling behavior evolve? An exploratory study in Java and C# applications, in: Software maintenance and evolution (ICSME), 2014 IEEE International Conference On. IEEE, pp. 31–40. Cacho, N., Barbosa, E. A., Araujo, J., Pranto, F., Garcia, A., Cesar, T., Soares, E., Cassio, A., Filipe, T., & Garcia, I. (2014a). How does exception handling behavior evolve? An exploratory study in Java and C# applications, in: Software maintenance and evolution (ICSME), 2014 IEEE International Conference On. IEEE, pp. 31–40.
Zurück zum Zitat Cacho, N., César, T., Filipe, T., Soares, E., Cassio, A., Souza, R., Garcia, I., Barbosa, E. A., & Garcia, A. (2014b). Trading robustness for maintainability: an empirical study of evolving C# programs, in: Proceedings of the 36th International Conference on Software Engineering, ICSE 2014. ACM: New York, pp. 584–595. https://doi.org/10.1145/2568225.2568308. Cacho, N., César, T., Filipe, T., Soares, E., Cassio, A., Souza, R., Garcia, I., Barbosa, E. A., & Garcia, A. (2014b). Trading robustness for maintainability: an empirical study of evolving C# programs, in: Proceedings of the 36th International Conference on Software Engineering, ICSE 2014. ACM: New York, pp. 584–595. https://​doi.​org/​10.​1145/​2568225.​2568308.
Zurück zum Zitat Capek, P., Král, E., & Senkerik, R. (2015). Towards an empirical analysis of .NET framework and C# language features’ adoption. In Computational science and computational intelligence (CSCI), 2015 international conference on. IEEE, pp. 865–866. Capek, P., Král, E., & Senkerik, R. (2015). Towards an empirical analysis of .NET framework and C# language features’ adoption. In Computational science and computational intelligence (CSCI), 2015 international conference on. IEEE, pp. 865–866.
Zurück zum Zitat Coleman, D., Ash, D., Lowther, B., & Oman, P. (1994). Using metrics to evaluate software system maintainability. IEEE Comput, 27(8), 44–49.CrossRef Coleman, D., Ash, D., Lowther, B., & Oman, P. (1994). Using metrics to evaluate software system maintainability. IEEE Comput, 27(8), 44–49.CrossRef
Zurück zum Zitat Deissenboeck, F., & Pizka, M. (2006). Concise and consistent naming. Software Quality Journal, 14(3), 261–282.CrossRef Deissenboeck, F., & Pizka, M. (2006). Concise and consistent naming. Software Quality Journal, 14(3), 261–282.CrossRef
Zurück zum Zitat Deitel, P., & Deitel, H. (2018). Visual C# how to program (6th ed.). Pearson. Deitel, P., & Deitel, H. (2018). Visual C# how to program (6th ed.). Pearson.
Zurück zum Zitat Fowler, M. (1999). Refactoring: improving the design of existing code. Addison-Wesley. Fowler, M. (1999). Refactoring: improving the design of existing code. Addison-Wesley.
Zurück zum Zitat Ge, X., DuBose, Q. L., & Murphy-Hill, E. (2012). Reconciling manual and automatic refactoring. In Proceedings of the 34th international conference on software engineering. IEEE Press, pp. 211–221. Ge, X., DuBose, Q. L., & Murphy-Hill, E. (2012). Reconciling manual and automatic refactoring. In Proceedings of the 34th international conference on software engineering. IEEE Press, pp. 211–221.
Zurück zum Zitat Ghosh, S., & Rana, A. K. (2011). Comparative study of the factors that affect maintainability. International Journal on Computer Science and Engineering, 3, 3763. Ghosh, S., & Rana, A. K. (2011). Comparative study of the factors that affect maintainability. International Journal on Computer Science and Engineering, 3, 3763.
Zurück zum Zitat Griswold, W. G. (1991). Program restructuring as an aid to software maintenance. University of Washington. Griswold, W. G. (1991). Program restructuring as an aid to software maintenance. University of Washington.
Zurück zum Zitat Hashim, K. (1996). A software maintainability attributes model. Malaysian Journal of Computer Science, 9, 92–97. Hashim, K. (1996). A software maintainability attributes model. Malaysian Journal of Computer Science, 9, 92–97.
Zurück zum Zitat Hejlsberg, A. (2008). Anders Hejlsberg talks about the C# Language [WWW Document]. URL https://www.youtube.com/watch?v=dc-YDS4JVA8. Accessed 11.12.17. Hejlsberg, A. (2008). Anders Hejlsberg talks about the C# Language [WWW Document]. URL https://​www.​youtube.​com/​watch?​v=​dc-YDS4JVA8.​ Accessed 11.12.17.
Zurück zum Zitat Kim, D., Murphy-Hill, E. R., Parnin, C., Bird, C., & Garcia, R. (2013). The reaction of open-source projects to new language features: an empirical study of C# generics. Journal of Object Technology, 12, 1–1.CrossRef Kim, D., Murphy-Hill, E. R., Parnin, C., Bird, C., & Garcia, R. (2013). The reaction of open-source projects to new language features: an empirical study of C# generics. Journal of Object Technology, 12, 1–1.CrossRef
Zurück zum Zitat Lawrie, D., Feild, H., & Binkley, D. (2007). Quantifying identifier quality: an analysis of trends. Empirical Software Engineering, 12(4), 359–388.CrossRef Lawrie, D., Feild, H., & Binkley, D. (2007). Quantifying identifier quality: an analysis of trends. Empirical Software Engineering, 12(4), 359–388.CrossRef
Zurück zum Zitat Lientz, B. P., & Swanson, E. B. (1980). Software maintenance management: a study of the maintenance of computer application software in 487 data processing organizations. Addison-Wesley. Lientz, B. P., & Swanson, E. B. (1980). Software maintenance management: a study of the maintenance of computer application software in 487 data processing organizations. Addison-Wesley.
Zurück zum Zitat Marcus, A., & Maletic, J. I. (2001). Identification of high-level concept clones in source code, in: Automated software engineering, 2001.(ASE 2001). Proceedings. 16th annual international conference on. IEEE, pp. 107–114. Marcus, A., & Maletic, J. I. (2001). Identification of high-level concept clones in source code, in: Automated software engineering, 2001.(ASE 2001). Proceedings. 16th annual international conference on. IEEE, pp. 107–114.
Zurück zum Zitat Martin, R. C. (2009). Clean code: a handbook of agile software craftsmanship. Pearson Education. Martin, R. C. (2009). Clean code: a handbook of agile software craftsmanship. Pearson Education.
Zurück zum Zitat Mens, T., et al. (2004). A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2), 126–139.CrossRef Mens, T., et al. (2004). A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2), 126–139.CrossRef
Zurück zum Zitat Murphy-Hill, E., & Black, A. P. (2008). Refactoring tools: fitness for purpose. IEEE Software, 25(5), 38–44.CrossRef Murphy-Hill, E., & Black, A. P. (2008). Refactoring tools: fitness for purpose. IEEE Software, 25(5), 38–44.CrossRef
Zurück zum Zitat Okur, S., & Dig, D. (2012). How do developers use parallel libraries? In Proceedings of the ACM SIGSOFT 20th international symposium on the foundations of software engineering, FSE ‘12. ACM, New York, NY, USA, pp. 54:1–54:11. https://doi.org/10.1145/2393596.2393660. Okur, S., & Dig, D. (2012). How do developers use parallel libraries? In Proceedings of the ACM SIGSOFT 20th international symposium on the foundations of software engineering, FSE ‘12. ACM, New York, NY, USA, pp. 54:1–54:11. https://​doi.​org/​10.​1145/​2393596.​2393660.
Zurück zum Zitat Okur, S., Hartveld, D. L., Dig, D., van Deursen, A. (2014). A study and toolkit for asynchronous programming in C#. In Proceedings of the 36th international conference on software engineering. ACM, pp. 1117–1127. Okur, S., Hartveld, D. L., Dig, D., van Deursen, A. (2014). A study and toolkit for asynchronous programming in C#. In Proceedings of the 36th international conference on software engineering. ACM, pp. 1117–1127.
Zurück zum Zitat Oliveira, J., Borges, D., Silva, T., Cacho, N., & Castor, F. (2018). Do android developers neglect error handling? A maintenance-centric study on the relationship between android abstractions and uncaught exceptions. Journal of Systems and Software, 136, 1–18.CrossRef Oliveira, J., Borges, D., Silva, T., Cacho, N., & Castor, F. (2018). Do android developers neglect error handling? A maintenance-centric study on the relationship between android abstractions and uncaught exceptions. Journal of Systems and Software, 136, 1–18.CrossRef
Zurück zum Zitat Opdyke, W. F. (1992). Refactoring: a program restructuring aid in designing object-oriented application frameworks. University of Illinois at Urbana-Champaign. Opdyke, W. F. (1992). Refactoring: a program restructuring aid in designing object-oriented application frameworks. University of Illinois at Urbana-Champaign.
Zurück zum Zitat Peercy, D. E. (1981). A software maintainability evaluation methodology. IEEE Transactions on Software Engineering, SE-7(4), 343–351.CrossRef Peercy, D. E. (1981). A software maintainability evaluation methodology. IEEE Transactions on Software Engineering, SE-7(4), 343–351.CrossRef
Zurück zum Zitat Shore J. (2004). Design debt. Software Profitability. Shore J. (2004). Design debt. Software Profitability.
Zurück zum Zitat Soares, G., Gheyi, R., Serey, D., & Massoni, T. (2010). Making program refactoring safer. IEEE Software, 27(4), 52–57.CrossRef Soares, G., Gheyi, R., Serey, D., & Massoni, T. (2010). Making program refactoring safer. IEEE Software, 27(4), 52–57.CrossRef
Zurück zum Zitat Szoke, G., Nagy, C., Fülöp, L. J., Ferenc, R., & Gyimóthy, T. (2015). FaultBuster: an automatic code smell refactoring toolset, in: Source code analysis and manipulation (SCAM), 2015 IEEE 15th international working conference on. IEEE, pp. 253–258. Szoke, G., Nagy, C., Fülöp, L. J., Ferenc, R., & Gyimóthy, T. (2015). FaultBuster: an automatic code smell refactoring toolset, in: Source code analysis and manipulation (SCAM), 2015 IEEE 15th international working conference on. IEEE, pp. 253–258.
Zurück zum Zitat Vidal, S. A., Marcos, C., & Díaz-Pace, J. A. (2016). An approach to prioritize code smells for refactoring. Automated Software Engineering, 23(3), 501–532.CrossRef Vidal, S. A., Marcos, C., & Díaz-Pace, J. A. (2016). An approach to prioritize code smells for refactoring. Automated Software Engineering, 23(3), 501–532.CrossRef
Metadaten
Titel
To var or not to var: how do C# developers use and misuse implicit and explicit typing?
verfasst von
Pierre A. Akiki
Publikationsdatum
16.11.2018
Verlag
Springer US
Erschienen in
Software Quality Journal / Ausgabe 3/2019
Print ISSN: 0963-9314
Elektronische ISSN: 1573-1367
DOI
https://doi.org/10.1007/s11219-018-9426-6

Weitere Artikel der Ausgabe 3/2019

Software Quality Journal 3/2019 Zur Ausgabe