Code Spartanization: one rational approach for resolving religious style wars

Spartan programming is a coding style which tries to minimize the elements of code, like in a laconic speech. In the context of code, the minimized elements of speech include lines, characters, arguments, nesting use of ifs and whiles, etc. The style is achieved by the process of repeated application of code transformation techniques, or refactoring operations, drawn from the spartan toolbox of tippers. Each tipper improves at least one of the code size metrics, without degrading any of the others. We present the unique look of spartan code, and the process of achieving it, including the three main kinds of tippers: structural, nominal, and modular. We do not make the case for the spartan style here, leaving the readers to find beauty or savageness in it. The evaluation part of this work gives evidence that the application of structural tippers contributes to the naturalness of software.

[1]  Donald E. Knuth,et al.  Structured Programming with go to Statements , 1974, CSUR.

[2]  Jeffrey H. Meyerson,et al.  The Go Programming Language , 2014, IEEE Softw..

[3]  William A. Wulf,et al.  A case against the GOTO , 1972, ACM '72.

[4]  Edsger W. Dijkstra,et al.  Letters to the editor: go to statement considered harmful , 1968, CACM.

[5]  Bertrand Meyer,et al.  Proceedings, technology of object-oriented languages, TOOLS 26, August 3-7, 1998, Santa Barbara, California , 1998 .

[6]  James Gosling,et al.  The Java Programming Language" The Java Series , 1996 .

[7]  Ying Zou,et al.  Cross-Project Defect Prediction Using a Connectivity-Based Unsupervised Classifier , 2016, 2016 IEEE/ACM 38th International Conference on Software Engineering (ICSE).

[8]  Gregor von Bochmann,et al.  Multiple exits from a loop without the GOTO , 1973, Commun. ACM.

[9]  Peyton Jones,et al.  Haskell 98 language and libraries : the revised report , 2003 .

[10]  Karl Lieberherr,et al.  Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns , 1995 .

[11]  Joseph Gil,et al.  Structured gotos are (Slightly) harmful , 2016, SAC.

[12]  Joseph Gil,et al.  On the correlation between size and metric validity , 2017, Empirical Software Engineering.

[13]  Charles A. Sutton,et al.  Mining source code repositories at massive scale using language modeling , 2013, 2013 10th Working Conference on Mining Software Repositories (MSR).

[14]  Andrew Davison A Linguistic Contribution to Goto-Less Programming , 1995 .

[15]  Joseph Gil,et al.  When do Software Complexity Metrics Mean Nothing? - When Examined out of Context , 2016, J. Object Technol..

[16]  Joseph Gil,et al.  How much information do software metrics contain? , 2011, PLATEAU '11.

[17]  Lawrence Clark,et al.  A linguistic contribution to GOTO-less programming , 1984, CACM.

[18]  Th. A. Zoethout,et al.  Why the goto is harmful , 1979, SIGP.

[19]  William G. Griswold,et al.  Tool support for planning the restructuring of data abstractions in large systems , 1996, SIGSOFT '96.

[20]  Javier Farreres The Programming Language , 2004 .

[21]  Greg Lindstrom,et al.  Programming with Python , 2005, IT Professional.

[22]  Ken Arnold,et al.  The Java Programming Language , 1996 .

[23]  Zhendong Su,et al.  On the naturalness of software , 2012, ICSE 2012.

[24]  R. Holmes,et al.  Using structural context to recommend source code examples , 2005, Proceedings. 27th International Conference on Software Engineering, 2005. ICSE 2005..

[25]  D. J. Wheeler,et al.  A Block-sorting Lossless Data Compression Algorithm , 1994 .

[26]  Dror G. Feitelson,et al.  On the effect of code regularity on comprehension , 2014, ICPC 2014.

[27]  Joseph Gil,et al.  When do Software Complexity Metrics Mean Nothing? – When Examined out of Context. , 2016 .

[28]  John F. Wakerly,et al.  The programming language PASCAL , 1979, Microprocessors and microsystems.

[29]  Lyle Ramshaw,et al.  Eliminating go to's while preserving program structure , 1988, JACM.