skip to main content
10.1145/1599410.1599414acmconferencesArticle/Chapter ViewAbstractPublication PagesppdpConference Proceedingsconference-collections
research-article

Automatic refactoring of Erlang programs

Published: 07 September 2009 Publication History

Abstract

This paper describes the design goals and current status of tidier, a software tool that tidies Erlang source code, making it cleaner, simpler, and often also more efficient. In contrast to other refactoring tools, tidier is completely automatic and is not tied to any particular editor or IDE. Instead, tidier comes with a suite of code transformations that can be selected by its user via command-line options and applied in bulk on a set of modules or entire applications using a simple command. Alternatively, users can use tidier's GUI to inspect one by one the transformations that will be performed on their code and manually select only those that they fancy. We have used tidier to clean up various applications of Erlang/OTP and have tested it on many open source Erlang code bases of significant size. We briefly report our experiences and show opportunities for tidier's current set of transformations on existing Erlang code out there. As a by-product, our paper also documents what we believe are good coding practices in Erlang. Last but not least, our paper describes in detail the automatic code cleanup methodology we advocate and a set of refactorings which are general enough to be applied, as is or with only small modifications, to the source code of programs written in Haskell or Clean and possibly even in non-functional languages.

References

[1]
J. Armstrong. A history of Erlang. In HOPL III: Proceedings of the third ACM SIGPLAN Conference on History of Programming Languages, pages 6-1--6-26, New York, NY, USA, 2007. ACM.
[2]
T. Avgerinos and K. Sagonas. Cleaning up Erlang code is a dirty job but somebody's gotta do it. In Proceedings of the Eighth ACM SIGPLAN Erlang Workshop, New York, NY, USA, Sept. 2009. ACM.
[3]
R. Carlsson. Syntax tools reference manual, version 1.6, Apr. 2009. http://www.erlang.org/doc/apps/syntax_tools/.
[4]
M. Fowler, K. Beck, J. Brant, W. Opdyke, and D. Roberts. Refactoring: Improving the Design of Existing Code. Addison-Wesley, Reading, Massachusetts, 2001.
[5]
P. Gustafsson and K. Sagonas. Bit-level binaries and generalized comprehensions in Erlang. In Proceedings of the Fourth ACM SIGPLAN Erlang Workshop, pages 1--8, New York, NY, USA, Sept. 2005. ACM.
[6]
H. Li and S. Thompson. Clone detection and removal for Erlang/OTP within a refactoring environment. In Proceedings of the ACM SIGPLAN Symposium on Partial Evaluation and Semantics-Based Program Manipulation, pages 169--177, New York, NY, USA, Jan. 2009. ACM.
[7]
H. Li, S. Thompson, G. Orösz, and M. Tóth. Refactoring with Wrangler, updated: Data and process refactorings, and integration with Eclipse. In Proceedings of the 7th ACM SIGPLAN Workshop on Erlang, pages 61--72, New York, NY, USA, Sept. 2008. ACM.
[8]
H. Li, S. Thompson, and C. Reinke. Tool support for refactoring functional programs. In Proceedings of the ACM SIGPLAN Workshop on Haskell, pages 27--38, New York, NY, USA, Aug. 2003. ACM.
[9]
T. Lindahl and K. Sagonas. Detecting software defects in telecom applications through lightweight static analysis: A war story. In C. Wei-Ngan, editor, Programming Languages and Systems: Proceedings of the Second Asian Symposium (APLAS'04), volume 3302 of LNCS, pages 91--106. Springer, Nov. 2004.
[10]
L. Lövei, Cs. Hoch, H. Köllő, T. Nagy, A. Nagyné-Víg, D. Horpácsi, R. Kitlei, and R. Király. Refactoring module structure. In Proceedings of the 7th ACM SIGPLAN Workshop on Erlang, pages 83--89, New York, NY, USA, Sept. 2008. ACM.
[11]
L. Lövei, Z. Horváth, T. Kozsik, and R. Király. Introducing records by refactoring. In Proceedings of the 6th ACM SIGPLAN Workshop Erlang, pages 18--28, New York, NY, USA, Sept. 2007. ACM.
[12]
T. Mens and T. Tourwé. A survey of software refactoring. IEEE Transactions on Software Engineering, 30(2):126--139, Feb. 2004.
[13]
T. Nagy and A. Nagyné-Víg. Erlang testing and tools survey. In Proceedings of the 7th ACM SIGPLAN Workshop on Erlang, pages 21--28, New York, NY, USA, Sept. 2008. ACM.
[14]
R.A. O'Keefe. Erlang Enhancement Proposal: Comprehension multigenerators, Aug. 2008. http://www.erlang.org/eeps/eep-0019.html.
[15]
ReSharper 4.5. http://www.jetbrains.com/resharper/.
[16]
A. Serebrenik, T. Schrijvers, and B. Demoen. Improving Prolog programs: Refactoring for Prolog. Theory and Practice of Logic Programming, 8(2):201--215, Mar. 2008.
[17]
P. Wadler. Deforestation: Transforming programs to eliminate trees. Theoretical Comput. Sci., 73(2):231--248, 1990.

Cited By

View all
  • (2023)Towards a Catalog of Refactorings for Elixir2023 IEEE International Conference on Software Maintenance and Evolution (ICSME)10.1109/ICSME58846.2023.00045(358-362)Online publication date: 1-Oct-2023
  • (2020)Transformations towards clean functional codeProceedings of the 19th ACM SIGPLAN International Workshop on Erlang10.1145/3406085.3409010(24-30)Online publication date: 23-Aug-2020
  • (2019)Teaching the art of functional programming using automated grading (experience report)Proceedings of the ACM on Programming Languages10.1145/33417193:ICFP(1-15)Online publication date: 26-Jul-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
PPDP '09: Proceedings of the 11th ACM SIGPLAN conference on Principles and practice of declarative programming
September 2009
324 pages
ISBN:9781605585680
DOI:10.1145/1599410
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

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 07 September 2009

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. code cleanup
  2. code simplification
  3. erlang
  4. program transformation
  5. refactoring

Qualifiers

  • Research-article

Conference

PPDP '09
Sponsor:

Acceptance Rates

Overall Acceptance Rate 230 of 486 submissions, 47%

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)4
  • Downloads (Last 6 weeks)0
Reflects downloads up to 02 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2023)Towards a Catalog of Refactorings for Elixir2023 IEEE International Conference on Software Maintenance and Evolution (ICSME)10.1109/ICSME58846.2023.00045(358-362)Online publication date: 1-Oct-2023
  • (2020)Transformations towards clean functional codeProceedings of the 19th ACM SIGPLAN International Workshop on Erlang10.1145/3406085.3409010(24-30)Online publication date: 23-Aug-2020
  • (2019)Teaching the art of functional programming using automated grading (experience report)Proceedings of the ACM on Programming Languages10.1145/33417193:ICFP(1-15)Online publication date: 26-Jul-2019
  • (2019)Lightweight multi-language syntax transformation with parser parser combinatorsProceedings of the 40th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/3314221.3314589(363-378)Online publication date: 8-Jun-2019
  • (2019)Towards s/engineer/botProceedings of the 1st International Workshop on Bots in Software Engineering10.1109/BotSE.2019.00019(43-47)Online publication date: 27-May-2019
  • (2017)Scaling ReliablyACM Transactions on Programming Languages and Systems10.1145/310793739:4(1-46)Online publication date: 17-Aug-2017
  • (2013)Refactoring MATLABProceedings of the 22nd international conference on Compiler Construction10.1007/978-3-642-37051-9_12(224-243)Online publication date: 16-Mar-2013
  • (2010)Quickchecking refactoring toolsProceedings of the 9th ACM SIGPLAN workshop on Erlang10.1145/1863509.1863521(75-80)Online publication date: 30-Sep-2010
  • (2010)Analysis of preprocessor constructs in ErlangProceedings of the 9th ACM SIGPLAN workshop on Erlang10.1145/1863509.1863517(45-56)Online publication date: 30-Sep-2010
  • (2009)Cleaning up Erlang code is a dirty job but somebody's gotta do itProceedings of the 8th ACM SIGPLAN workshop on ERLANG10.1145/1596600.1596602(1-10)Online publication date: 5-Sep-2009

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media