ABSTRACT
Natural language elements, e.g., todo comments, are frequently used to communicate among developers and to describe tasks that need to be performed (actions) when specific conditions hold on artifacts related to the code repository (triggers), e.g., from the Apache Struts project: “remove expectedJDK15 and if() after switching to Java 1.6”. As projects evolve, development processes change, and development teams reorganize, these comments, because of their informal nature, frequently become irrelevant or forgotten. We present the first framework, dubbed TrigIt, to specify trigger-action todo comments in executable format. Thus, actions are executed automatically when triggers evaluate to true. TrigIt specifications are written in the host language (e.g., Java) and are evaluated as part of the build process. The triggers are specified as query statements over abstract syntax trees, abstract representation of build configuration scripts, issue tracking systems, and system clock time. The actions are either notifications to developers or code transformation steps. We implemented TrigIt for the Java programming language and migrated 44 existing trigger-action comments from several popular open-source projects. Evaluation of TrigIt, via a user study, showed that users find TrigIt easy to learn and use. TrigIt has the potential to enforce more discipline in writing and maintaining comments in large code repositories.
References
- Rui Abreu, Hakan Erdogmus, and Alexandre Perez. 2015. CodeAware: Sensorbased fine-grained monitoring and management of software artifacts. In International Conference on Software Engineering, Vol. 2. 551–554. Google Scholar
Digital Library
- Miltiadis Allamanis, Earl T Barr, Premkumar Devanbu, and Charles Sutton. 2018. A survey of machine learning for big code and naturalness. Comput. Surveys 51, 4 (2018), 81. Google Scholar
Digital Library
- Miltos Allamanis, Daniel Tarlow, Andrew Gordon, and Yi Wei. 2015. Bimodal modelling of source code and natural language. In International Conference on Machine Learning. 2123–2132. Google Scholar
Digital Library
- Oracle and/or its affiliates. 2019. Chapter 5. Loading, Linking, and Initializing. https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-5.html.Google Scholar
- Oracle and/or its affiliates. 2019. The Reflection API. https://docs.oracle.com/ javase/tutorial/reflect/.Google Scholar
- Oracle and/or its affiliates. 2019. Stream (Java Platform SE 8). https://docs.oracle. com/javase/8/docs/api/java/util/stream/Stream.html.Google Scholar
- Apache. 2019. Apache Struts. https://github.com/apache/struts.Google Scholar
- Gabriele Bavota and Barbara Russo. 2016. A large-scale empirical study on selfadmitted technical debt. In International Working Conference on Mining Software Repositories. 315–326. Google Scholar
Digital Library
- Arianna Blasi, Alberto Goffi, Konstantin Kuznetsov, Alessandra Gorla, Michael D. Ernst, Mauro Pezzè, and Sergio Delgado Castellanos. 2018. Translating code comments to procedure specifications. In International Symposium on Software Testing and Analysis. 242–253. Google Scholar
Digital Library
- Shobhit Chaurasia and Raymond J. Mooney. 2017. Dialog for language to code. In International Joint Conference on Natural Language Processing. 175–180.Google Scholar
- OW2 Consortium. 2018. ASM. http://asm.ow2.io.Google Scholar
- Li Dong and Mirella Lapata. 2016. Language to logical form with neural attention. In Annual Meeting of the Association for Computational Linguistics. 33–43.Google Scholar
Cross Ref
- Elastic. 2019. Elastic Elasticsearch. https://github.com/elastic/elasticsearch.Google Scholar
- Robert E. Filman and Daniel P. Friedman. 2000. Aspect-oriented programming is quantification and obliviousness. Technical Report. Research Institute for Advanced Computer Science. Google Scholar
Digital Library
- Beat Fluri, Michael Wursch, and Harald C. Gall. 2007. Do code and comments coevolve? On the relation between source code and comment changes. In Working Conference on Reverse Engineering. 70–79. Google Scholar
Digital Library
- Eclipse Foundation. 2019. Eclipse Java development tools (JDT). https://www. eclipse.org/jdt.Google Scholar
- Martin Fowler, Kent Beck, John Brant, William Opdyke, and Don Roberts. 1999. Refactoring: Improving the design of existing code. Google Scholar
Digital Library
- Apache Gobblin. 2019. Apache Gobblin. https://github.com/apache/incubatorgobblin.Google Scholar
- Google. 2019. Google Guava. https://github.com/google/guava.Google Scholar
- Jhe-Jyun Guo, Nien-Lin Hsueh, Wen-Tin Lee, and Shi-Chuen Hwang. 2014. Improving software maintenance for pattern-based software development: A comment refactoring approach. In International Conference on Trustworthy Systems and their Applications. 75–79. Google Scholar
Digital Library
- Elnar Hajiyev, Mathieu Verbaere, and Oege de Moor. 2006. CodeQuest: Scalable source code queries with Datalog. In European Conference on Object-Oriented Programming. 2–27. Google Scholar
Digital Library
- Dorsaf Haouari, Houari Sahraoui, and Philippe Langlais. 2011. How good is your comment? A study of comments in Java programs. In International Symposium on Empirical Software Engineering and Measurement. 137–146. Google Scholar
Digital Library
- Xing Hu, Ge Li, Xin Xia, David Lo, and Zhi Jin. 2018. Deep code comment generation. In International Conference on Program Comprehension. 200–210. Google Scholar
Digital Library
- Qiao Huang, Emad Shihab, Xin Xia, David Lo, and Shanping Li. 2018. Identifying self-admitted technical debt in open source projects using text mining. Empirical Software Engineering 23, 1 (2018), 418–451. Google Scholar
Digital Library
- Walid M. Ibrahim, Nicolas Bettenburg, Bram Adams, and Ahmed E. Hassan. 2012. On the relationship between comment update practices and software bugs. Journal of Systems and Software 85, 10 (2012), 2293–2304. Google Scholar
Digital Library
- Apache Incubator-Wave. 2019. Apache Incubator-Wave. https://github.com/ apache/incubator-wave.Google Scholar
- Srinivasan Iyer, Ioannis Konstas, Alvin Cheung, and Luke Zettlemoyer. 2016. Summarizing source code using a neural attention model. In Annual Meeting of the Association for Computational Linguistics. 2073–2083.Google Scholar
Cross Ref
- Doug Janzen and Kris De Volder. 2003. Navigating and querying code without getting lost. In International Conference on Aspect-Oriented Software Development. 178–187. Google Scholar
Digital Library
- Huiqing Li and Simon Thompson. 2012. A domain-specific language for scripting refactorings in Erlang. In Fundamental Approaches to Software Engineering. 501– 515. Google Scholar
Digital Library
- Chang Liu, Xinyun Chen, Eui Chul Shin, Mingcheng Chen, and Dawn Song. 2016. Latent attention for if-then program synthesis. In Advances in Neural Information Processing Systems. 4574–4582. Google Scholar
Digital Library
- Innobuilt Software LLC. 2019. All your TODO comments in one place. https: //imdone.io/.Google Scholar
- Everton da S Maldonado, Rabe Abdalkareem, Emad Shihab, and Alexander Serebrenik. 2017. An empirical study on the removal of self-admitted technical debt. In International Conference on Software Maintenance and Evolution. 238–248.Google Scholar
Cross Ref
- Laura Moreno, Jairo Aponte, Giriprasad Sridhara, Andrian Marcus, Lori Pollock, and K Vijay-Shanker. 2013. Automatic generation of natural language summaries for Java classes. In International Conference on Program Comprehension. 23–32.Google Scholar
Cross Ref
- Dana Movshovitz-Attias and William W Cohen. 2013. Natural language models for predicting programming comments. In Annual Meeting of the Association for Computational Linguistics. 35–40.Google Scholar
- Pengyu Nie, Junyi Jessy Li, Sarfraz Khurshid, Raymond Mooney, and Milos Gligoric. 2018. Natural language processing and program analysis for supporting todo comments as software evolves. In Workshops of the the AAAI Conference on Artificial Intelligence. 775–778.Google Scholar
- Pengyu Nie, Rishabh Rai, Junyi Jessy Li, Sarfraz Khurshid, Raymond J. Mooney, and Milos Gligoric. 2018.Google Scholar
- Executable trigger-action comments. CoRR abs/1808.01729 (2018).Google Scholar
- William F. Opdyke. 1992. Refactoring object-oriented frameworks. Ph.D. Dissertation. University of Illinois at Urbana-Champaign. Google Scholar
Digital Library
- William F. Opdyke and Ralph E. Johnson. 1990. Refactoring: An aid in designing application frameworks and evolving object-oriented systems. In Symposium on Object-Oriented Programming Emphasizing Practical Applications. 145–161.Google Scholar
- Alim Ozdemir, Ayse Tosun, Hakan Erdogmus, and Rui Abreu. 2018. Lightweight source code monitoring with Triggr. In Automated Software Engineering, Tool Demonstrations. 864–867. Google Scholar
Digital Library
- Luca Pascarella and Alberto Bacchelli. 2017. Classifying code comments in Java open-source software systems. In International Working Conference on Mining Software Repositories. 227–237. Google Scholar
Digital Library
- Hung Phan, Hoan Anh Nguyen, Tien N Nguyen, and Hridesh Rajan. 2017. Statistical learning for inference between implementations and documentation. In International Conference on Software Engineering: New Ideas and Emerging Technologies Results Track. 27–30. Google Scholar
Digital Library
- Aniket Potdar and Emad Shihab. 2014. An exploratory study on self-admitted technical debt. In International Conference on Software Maintenance and Evolution. 91–100. Google Scholar
Digital Library
- Chris Quirk, Raymond J Mooney, and Michel Galley. 2015. Language to Code: Learning semantic parsers for If-This-Then-That recipes.. In Annual Meeting of the Association for Computational Linguistics. 878–888.Google Scholar
Cross Ref
- Inderjot Kaur Ratol and Martin P. Robillard. 2017. Detecting fragile comments. In Automated Software Engineering. 112–122. Google Scholar
Digital Library
- Justin Searls. 2019. todo_or_die. https://github.com/searls/todo_or_die.Google Scholar
- Giriprasad Sridhara. 2016. Automatically detecting the up-to-date status of ToDo comments in Java programs. In India Software Engineering Conference. 16–25. Google Scholar
Digital Library
- Giriprasad Sridhara, Emily Hill, Divya Muppaneni, Lori Pollock, and K Vijay-Shanker. 2010. Towards automatically generating summary comments for Java methods. In Automated Software Engineering. 43–52. Google Scholar
Digital Library
- Giriprasad Sridhara, Lori Pollock, and K Vijay-Shanker. 2011. Generating parameter comments and integrating with method summaries. In International Conference on Program Comprehension. 71–80. Google Scholar
Digital Library
- Margaret-Anne Storey, Jody Ryall, R. Ian Bull, Del Myers, and Janice Singer. 2008. TODO or to bug. In International Conference on Software Engineering. 251–260.Google Scholar
Digital Library
- Adam Svensson. 2015. Reducing outdated and inconsistent code comments during software development: The comment validator program. Master’s thesis. Uppsala University, Information Systems.Google Scholar
- Lin Tan, Ding Yuan, Gopal Krishna, and Yuanyuan Zhou. 2007. /*iComment: bugs or bad comments?*/. In Symposium on Operating Systems Principles. 145–158. Google Scholar
Digital Library
- Shin Hwei Tan, Darko Marinov, Lin Tan, and Gary T. Leavens. 2012. @tComment: Testing Javadoc comments to detect comment-code inconsistencies. In International Conference on Software Testing, Verification, and Validation. 260–269. Google Scholar
Digital Library
- Lance Tokuda and Don Batory. 1999. Evolving object-oriented designs with refactorings. In Automated Software Engineering. 174–181. Google Scholar
Digital Library
- TrigIt. 2019. TrigIt web page. http://cozy.ece.utexas.edu/trigit.Google Scholar
- Michele Tufano, Fabio Palomba, Gabriele Bavota, Massimiliano Di Penta, Rocco Oliveto, Andrea De Lucia, and Denys Poshyvanyk. 2017. There and back again: Can you compile that snapshot? Journal of Software: Evolution and Process (2017), e1838.Google Scholar
- Raoul-Gabriel Urma and Alan Mycroft. 2012. Programming language evolution via source code query languages. In Workshop on Evaluation and Usability of Programming Languages and Tools. 35–38. Google Scholar
Digital Library
- Raoul-Gabriel Urma and Alan Mycroft. 2015. Source-code queries with graph databases—with application to programming language usage and evolution. Science of Computer Programming 97, P1 (2015), 127–134. Google Scholar
Digital Library
- Mohsen Vakilian, Nicholas Chen, Roshanak Zilouchian Moghaddam, Stas Negara, and Ralph E. Johnson. 2013. A compositional paradigm of automating refactorings. In European Conference on Object-Oriented Programming. Berlin, Heidelberg, 527– 551. Google Scholar
Digital Library
- Mathieu Verbaere, Ran Ettinger, and Oege de Moor. 2006. JunGL: A scripting language for refactoring. In International Conference on Software Engineering. 172–181. ESEC/FSE ’19, August 26–30, 2019, Tallinn, Estonia Pengyu Nie, Rishabh Rai, Junyi Jessy Li, Sarfraz Khurshid, Raymond J. Mooney, and Milos Gligoric Google Scholar
Digital Library
- Pengcheng Yin and Graham Neubig. 2017. A syntactic neural model for generalpurpose code generation. In Annual Meeting of the Association for Computational Linguistics. 440–450.Google Scholar
- Annie T. T. Ying, James L. Wright, and Steven Abrams. 2005. Source code that talks: An exploration of Eclipse task comments and their implication to repository mining. In International Working Conference on Mining Software Repositories. 1–5. Google Scholar
Digital Library
- Fiorella Zampetti, Cedric Noiseux, Giuliano Antoniol, Foutse Khomh, and Massimiliano Di Penta. 2017. Recommending when design technical debt should be self-admitted. In International Conference on Software Maintenance and Evolution. 216–226.Google Scholar
Cross Ref
Index Terms
A framework for writing trigger-action todo comments in executable format





Comments