ABSTRACT
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.
- M. Allamanis and C. Sutton. Mining source code repositories at massive scale using lang, modeling. In Proc. of 10th Working Conf. on Mining Soft. Repositories (MSR'13), pages 207--216, San Francisco, California, USA, May18--19 2013. Google ScholarDigital Library
- K. Arnold and J. Gosling. The JAVA Programming Language. The Java Series. Addison-Wesley, Reading, MA, 1996. Google ScholarDigital Library
- J. Atwood. Spartan programming. https://blog.codinghorror.com/spartan-programming/.Google Scholar
- G. V. Bochmann. Multiple exits from a loop without the goto. Commun. ACM, 16(7):443--444, July 1973. Google ScholarDigital Library
- M. Burrows and D. J. Wheeler. A block-sorting lossless data compression algorithm. Technical Report 124, Digital Systems Research Center, May 10 1994.Google Scholar
- L. Clark. A linguistic contribution to goto-less prog. Commun. ACM, 27(4):349--350, Apr. 1984. Google ScholarDigital Library
- E. W. Dijkstra. Letters to the editor: Go to statement considered harmful. Commun. ACM, 11(3):147--148, Mar. 1968. Google ScholarDigital Library
- A. A. Donovan and B. W. Kernighan. The Go Programming Language. Addison-Wesley Professional, Nov. 2015. Google ScholarDigital Library
- M. Ege, Raimund Singh and B. Meyer. Proceedings of the technology of object-oriented languages 26. In Proceedings of the Technology of Object-Oriented Languages 26, TOOLS '98, 1998.Google Scholar
- J. Y. Gil and G. Lalouche. When do soft, complexity metrics mean nothing? ---when examined out of context. Journal of Object Technology, 15(1):2:1--25, 2016.Google ScholarCross Ref
- Y. Gil, M. Goldstein, and D. Moshkovich. How much information do soft, metrics contain? In Proc. of the 3rd ACM SIGPLAN Workshop on Evaluation and Usability of Prog. Lang, and Tools, PLATEAU '11, pages 57--64, New York, NY, USA, 2011. ACM Press. Google ScholarDigital Library
- Y. Gil and G. Lalouche. On the correlation between size and metric validity. Empirical Soft. Eng., 2016.Google Scholar
- W. G. Griswold, M. I. Chen, R. W. Bowdidge, J. L. Cabaniss, V. B. Nguyen, and J. David Morgenthaler. Tool support for planning the restructuring of data abstractions in large systems. IEEE Trans. Softw. Eng., 24(7):534--558, July 1998. Google ScholarDigital Library
- A. Hindle, E. T. Barr, Z. Su, M. Gabel, and P. Devanbu. On the naturalness of soft. In Proc. of the 34th Int. Conf. on Soft. Eng., ICSE '12, pages 837--847, Piscataway, NJ, USA, 2012. IEEE Press. Google ScholarDigital Library
- R. Holmes and G. C. Murphy. Using structural context to recommend source code examples. In Proc. of the 27th Conf. on Soft. Eng., ICSE '05, pages 117--125, New York, NY, USA, 2005. ACM Press. Google ScholarDigital Library
- A. Jbara and D. G. Feitelson. On the effect of code regularity on comprehension. In Proc. of 22nd Int. Conf. on Program Comprehension (ICPC'14), pages 189---200, June2--3 2014. Google ScholarDigital Library
- S. P. Jones. Haskell 98 Language and Libraries: The Revisited Report. Cambridge University Press, 2003.Google Scholar
- D. E. Knuth. Structured programming with go to statements. ACM Computing Surveys (CSUR), 6(4):261--301, Dec. 1974. Google ScholarDigital Library
- K. J. Lieberherr. Adaptive Object-Oriented Software: The Demeter Method with Propagation Patterns. PWS-Kent Publishing, 1996. Google ScholarDigital Library
- M. Lutz. Programming Python. O'Reilly, first edition, Oct. 1996. Google ScholarDigital Library
- L. Ramshaw. Eliminating go to's while preserving program structure. Journal of the ACM, 35(4):893--920, Oct. 1988. Google ScholarDigital Library
- E. Sennesh and Y. Gil. Structured gotos are (slightly) harmful. In Proc. of the 31st Annual ACM Symposium on Applied Computing, SAC '16, pages 1784--1789, 2016. Google ScholarDigital Library
- N. Wirth. The programming language Pascal. Acta Informatica, 1:35---63, 1971. Google ScholarDigital Library
- W. A. Wulf. A case against the GOTO. In E. N. Yourdon, editor, Classics in Soft. Eng., pages 83---98. Yourdon Press, Upper Saddle River, NJ, USA, 1979. Google ScholarDigital Library
- F. Zhang, Q. Zheng, Y. Zou, and A. E. Hassan. Cross-project defect prediction using a connectivity-based unsupervised classifier. In Proc. of the 38th Int. Conf. on Soft. Eng., ICSE '16, pages 309--320, New York, NY, USA, 2016. ACM. Google ScholarDigital Library
- T. A. Zoethout and E. I. N. Stein. Why the Goto is harmful. SIGPLAN Not., 14(11):116--122, Nov. 1979. Google ScholarDigital Library
Index Terms
- Code Spartanization: one rational approach for resolving religious style wars
Recommendations
A large-scale comparative analysis of Coding Standard conformance in Open-Source Data Science projects
ESEM '20: Proceedings of the 14th ACM / IEEE International Symposium on Empirical Software Engineering and Measurement (ESEM)Background: Meeting the growing industry demand for Data Science requires cross-disciplinary teams that can translate machine learning research into production-ready code. Software engineering teams value adherence to coding standards as an indication ...
Prioritising Refactoring Using Code Bad Smells
ICSTW '11: Proceedings of the 2011 IEEE Fourth International Conference on Software Testing, Verification and Validation WorkshopsWe investigated the relationship between six of Fowler et al.'s Code Bad Smells (Duplicated Code, Data Clumps, Switch Statements, Speculative Generality, Message Chains, and Middle Man) and software faults. In this paper we discuss how our results can ...
An interactive ambient visualization for code smells
SOFTVIS '10: Proceedings of the 5th international symposium on Software visualizationCode smells are characteristics of software that indicate that code may have a design problem. Code smells have been proposed as a way for programmers to recognize the need for restructuring their software. Because code smells can go unnoticed while ...
Comments