skip to main content
10.1145/2568225.2568309acmconferencesArticle/Chapter ViewAbstractPublication PagesicseConference Proceedingsconference-collections
research-article

A study and toolkit for asynchronous programming in c#

Published: 31 May 2014 Publication History

Abstract

Asynchronous programming is in demand today, because responsiveness is increasingly important on all modern devices. Yet, we know little about how developers use asynchronous programming in practice. Without such knowledge, developers, researchers, language and library designers, and tool providers can make wrong assumptions.
We present the first study that analyzes the usage of asynchronous programming in a large experiment. We analyzed 1378 open source Windows Phone (WP) apps, comprising 12M SLOC, produced by 3376 developers. Using this data, we answer 2 research questions about use and misuse of asynchronous constructs. Inspired by these findings, we developed (i) Asyncifier, an automated refactoring tool that converts callback-based asynchronous code to use async/await; (ii) Corrector, a tool that finds and corrects common misuses of async/await. Our empirical evaluation shows that these tools are (i) applicable and (ii) efficient. Developers accepted 314 patches generated by our tools.

References

[1]
J. Albahari and B. Albahari. CSharp 5.0 in a Nutshell: The Definitive Reference. O’Reilly Media, 2012.
[2]
Adsclient App. August’13, https://github.com/roelandmoors/adsclient.
[3]
Cimbalino-Phone-Toolkit App. August’13, https: //github.com/Cimbalino/Cimbalino-Phone-Toolkit.
[4]
Phoneguitartab App. August’13, http://phoneguitartab.codeplex.com/.
[5]
Playerframework App. August’13, http://playerframework.codeplex.com/.
[6]
Softbuild.Data App. August’13, https://github.com/CH3COOH/Softbuild.Data.
[7]
Scala Async. August’13, http: //docs.scala-lang.org/sips/pending/async.html.
[8]
Gavin Bierman, Claudio Russo, Geoffrey Mainland, Erik Meijer, and Mads Torgersen. Pause n Play: Formalizing Asynchronous CSharp. In Proceedings of the 26th European conference on Object-Oriented Programming, ECOOP ’12, pages 233–257, 2012.
[9]
Oscar Callaú, Romain Robbes, Éric Tanter, and David Röthlisberger. How developers use the dynamic features of programming languages. In Proceeding of the 8th Working Conference on Mining Software Repositories, MSR ’11, pages 23–32, 2011.
[10]
WPCollector Source Code. August’13, https://github.com/semihokur/wpcollector.
[11]
CodePlex. August’13, http://codeplex.com.
[12]
Danny Dig, John Marrero, and Michael D. Ernst. Refactoring sequential Java code for concurrency via concurrent libraries. In Proceedings of the 31st International Conference on Software Engineering, ICSE ’09, pages 397–407, 2009.
[13]
Danny Dig, Mihai Tarce, Cosmin Radoi, Marius Minea, and Ralph Johnson. Relooper. In Proceedings of the 24th ACM SIGPLAN Conference Companion on Object Oriented Programming Systems Languages and Applications, OOPSLA ’09, pages 793–794, 2009.
[14]
Indulged flickr App. August’13, https://github.com/powerytg/indulged-flickr.
[15]
Windows Forms. August’13, http://msdn.microsoft. com/en-us/library/dd30h2yb.aspx.
[16]
Windows Presentation Foundation. August’13, http:// msdn.microsoft.com/en-us/library/ms754130.aspx.
[17]
Gartner. August’13, http://www.gartner.com/newsroom/id/2153215.
[18]
Github. August’13, https://github.com.
[19]
Mark Grechanik, Collin McMillan, Luca DeFerrari, Marco Comi, Stefano Crespi, Denys Poshyvanyk, Chen Fu, Qing Xie, and Carlo Ghezzi. An empirical investigation into a large-scale Java open source code repository. In Proceedings of the International Symposium on Empirical Software Engineering and Measurement, ESEM ’10, pages 11–21, 2010.
[20]
Alex Gyori, Lyle Franklin, Danny Dig, and Jan Lahoda. Crossing the gap from imperative to functional programming through refactoring. In Proceedings of the Foundations of Software Engineering, FSE ’13, pages 543–553, 2013.
[21]
Best Practices in Asynchronous Programming. August’13, http://msdn.microsoft.com/en-us/ magazine/jj991977.aspx.
[22]
iRacerMotionControl App. August’13, https: //github.com/lanceseidman/iRacer_MotionControl.
[23]
Oracle JavaAWT. August’13, http://docs.oracle.com/javase/7/docs/api/java/ awt/package-summary.html.
[24]
Oracle JavaSwing. August’13, http://docs.oracle. com/javase/7/docs/technotes/guides/swing/.
[25]
Siim Karus and Harald Gall. A study of language usage evolution in open source software. In Proceeding of the 8th Working Conference on Mining Software Repositories, MSR ’11, pages 13–22, 2011.
[26]
Survival of the Forgest. August’13, http://redmonk. com/sogrady/2011/06/02/blackduck-webinar/.
[27]
Semih Okur and Danny Dig. How do developers use parallel libraries? In Proceedings of the ACM SIGSOFT 20th International Symposium on the Foundations of Software Engineering, FSE ’12, pages 54–65, 2012.
[28]
Chris Parnin, Christian Bird, and Emerson Murphy-Hill. Adoption and use of Java generics. Empirical Software Engineering, 18(6):1047–1089, 2013.
[29]
Microsoft Asynchronous Programming Patterns. August’13, http://msdn.microsoft.com/en-us/ library/jj152938.aspx.
[30]
The Roslyn Project. August’13, http://msdn.microsoft.com/en-us/hh500769.
[31]
Cosmin Radoi and Danny Dig. Practical static race detection for java parallel loops. In Proceedings of the 2013 International Symposium on Software Testing and Analysis, ISSTA ’13, pages 178–190, 2013.
[32]
Cimbalino Pull Request. August’13, https://github. com/Cimbalino/Cimbalino-Phone-Toolkit/pull/21.
[33]
OCell Pull Request. August’13, https://github.com/gjulianm/Ocell/pull/27.
[34]
ReSharper. August’13, http://www.jetbrains.com/resharper/.
[35]
Martin P. Robillard and Robert DeLine. A field study of API learning obstacles. Empirical Software Engineering, 16(6):703–732, December 2010.
[36]
Max Schäfer, Manu Sridharan, Julian Dolby, and Frank Tip. Refactoring Java programs for flexible locking. In Proceeding of the 33rd international conference on Software engineering, ICSE ’11, pages 71–80, 2011.
[37]
Windows Store. August’13, http://www.windowsphone.com/en-us/store.
[38]
Don Syme, Tomas Petricek, and Dmitry Lomov. The F# asynchronous programming model. In Proceedings of the 13th international conference on Practical aspects of declarative languages, PADL’11, pages 175–189, 2011.
[39]
Our Companion Website. August’13, http://learnasync.net.
[40]
Jan Wloka, Manu Sridharan, and Frank Tip. Refactoring for reentrancy. In Proceedings of the 7th Joint Meeting of the ACM SIGSOFT Symposium on the Foundations of Software Engineering, FSE ’09, pages 173–182, 2009.

Cited By

View all

Index Terms

  1. A study and toolkit for asynchronous programming in c#

    Recommendations

    Reviews

    Ganesh Bikshandi

    Several common mistakes that programmers commit while writing asynchronous (async) programs are addressed in this paper. First, the authors discuss the different kinds of async programs available (call based and task asynchronous pattern (TAP) based). The errors are caused by the misuse of async methods, which hurts performance and might cause serious problems like deadlocks. Examples are fire and forget async methods that cannot be waited on to get any useful result, and long-running async methods. Second, they introduce the async-await idiom (recently introduced). Third, they study common errors that programmers commit while using these application programming interfaces (APIs) and propose an automated solution to correct them. The paper's approach to using automated tools for converting callback-based code to async code deserves special mention. Such optimizations are hard to implement automatically and the paper succeeds at this. Another strong point of the paper is the fact that the authors use a vast number of real-world Windows Phone apps to derive their conclusions. Overall, the paper is very useful for Android app developers and researchers building automated tools for Android app development. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ICSE 2014: Proceedings of the 36th International Conference on Software Engineering
    May 2014
    1139 pages
    ISBN:9781450327565
    DOI:10.1145/2568225
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    In-Cooperation

    • TCSE: IEEE Computer Society's Tech. Council on Software Engin.

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 31 May 2014

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. C#
    2. Program transformation
    3. asynchronous

    Qualifiers

    • Research-article

    Conference

    ICSE '14
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 276 of 1,856 submissions, 15%

    Upcoming Conference

    ICSE 2025

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)71
    • Downloads (Last 6 weeks)8
    Reflects downloads up to 23 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media