Gamification for Enforcing Coding Conventions
Total Page:16
File Type:pdf, Size:1020Kb
Gamification for Enforcing Coding Conventions Christian R. Prause Matthias Jarke DLR Space Administration RWTH Aachen Königswinterer Str. 522-524 Institut i5 Bonn, Germany Aachen, Germany [email protected] [email protected] ABSTRACT quality characteristic means how cost-effectively developers Software is a knowledge intensive product, which can only can continuously improve and evolve the software. evolve if there is effective and efficient information exchange Maintainability is broken down into the sub-characteristics between developers. Complying to coding conventions im- analyzability, changeability, stability, testability and main- proves information exchange by improving the readability of tainability compliance. They describe how easy places to be source code. However, without some form of enforcement, changed and causes of faults can be located, how well fu- compliance to coding conventions is limited. We look at ture changes are supported and can be realized, how much the problem of information exchange in code and propose the software avoids unexpected effects from changes, how gamification as a way to motivate developers to invest in well the software supports validation efforts, and how com- compliance. Our concept consists of a technical prototype pliant the interior of the software is to maintainability stan- and its integration into a Scrum environment. By means of dards and conventions. Maintainability is like an internal two experiments with agile software teams and subsequent version of the usability quality characteristic, i.e., how easy surveys, we show that gamification can effectively improve developers can understand whether source code is suitable adherence to coding conventions. for certain purposes and how to use it for particular tasks and in specific conditions, how well inner workings can be learned, how much developers stay in control of the changes Categories and Subject Descriptors they make, how attractive the inner workings of the soft- D.2.3 [Software Engineering]: Coding Tools and Tech- ware appear to the developers, and how compliant they are niques; D.2.9 [Software Engineering]: Management to standards, conventions, style guides or regulations. When we speak of understandability, learning, attractiveness, and compliance in this paper, we mean this internal view and not General Terms the view from the end-user's external usability perspective. Human Factors, Documentation, Management, Measurement Maintainability is important for the evolvability of soft- ware. We argue that it is related to knowledge, and informa- Keywords tion exchange in the team. As a hidden quality characteris- tic, however, it is easily overlooked, and requires efforts and code style, gamification, software quality, experiment discipline that are not granted. In particular, human behav- ior is controlled by trading off the valences1 of alternative 1. INTRODUCTION actions all the time. If the valence of complying to conven- The standard ISO-9126 establishes a basic model of soft- tions is not high enough, developers will easily be drawn ware quality based on six quality characteristics (e.g., func- to other activities. The dilemma of information exchange tionality, maintainability) each subdivided into several sub- commences. The more freedom developers have, the more characteristics (e.g., analysability, changeability). These char- important such valence aspects are. Internal un-quality, also acteristics can be roughly divided into characteristics of ex- known as technical debt, increases (see Section 2). ternal and internal quality. The famous iceberg metaphor We propose gamification as a solution. Gamification refers illustrates this relationship: external quality is the iceberg's to the use of design elements characteristic for games in surfaced part that can be easily seen by users of the software. non-game contexts. It has gained considerable attention in Internal quality is the part dangerously hidden below the domains like productivity, finance, health, education, news, surface. Among the submerged parts, the maintainability and media. In this sense, gamification does not mean \play" but means to optimize one's behavior with respect to the rules in the sense of mechanism design [18, 55]. In a real- world context (programming) with real-world effects (read- ability of code and rewards), gamification is what connects the real-world on both sides using mechanisms known from games. For this approach to work, two different integra- PREPRINT. This is the author’s version of the work. It is posted here for your personal use. Not for redistribution. The definitive version was published in the following publication: 1In psychology, the term valence means the intrinsic attrac- ESEC/FSE’15, August 30 – September 4, 2015, Bergamo, Italy tiveness or aversiveness (i.e., positive or negative valence, ACM. 978-1-4503-3675-8/15/08 respectively) of an event, object, or situation [22]. http://dx.doi.org/10.1145/2786805.2786806 Self-archived at: https://www.drprause.de/publications/ 649 tions must be achieved: Firstly, a technical solution must into a danger to the project [13]. Some therefore even call be integrated into the development environment so that the not putting efforts into such information exchange unprofes- necessary development data can be obtained and prepared sional \anti-team behaviour" [33]. If information exchange is for gamification. For every developer, a reputation score is so important, why are programmers\notorious"[44] for their calculated that averages the compliance to coding conven- dislike of writing down knowledge in a readable form [26]? tions of the files the developer contributed to. Secondly, the The literature on programming lists countless different gamification must be integrated socially to affect the de- motives: time and schedule pressure; missing responsibil- velopers' valence judgments so that desirable behaviors will ity, education and professionalism; lack of incentives; care- emerge more often. We rely on the typical game design el- lessness, incompetence, \sapient" developers; human nature; ements of personal scores, transparent rules, leader board, additional (cognitive) effort; or operand conditioning, per- and real-world individual and group incentives that can be ceived boredom and pathological gambling. Writing down earned as team (see Section 3). information in a readable way costs a developer his precious In order to evaluate our game design, we set up two paral- time and (cognitive) efforts but has little immediate value for lel experiments with software development teams following himself. The potential values pay off much later and mainly the agile Scrum methodology. We distributed postgradu- benefit others [11, 15, 23, 30, 32, 33, 36, 41, 43, 48, 49, 56]. ate developers with similar skills onto two teams of green- We note that information exchange through code is an in- field projects. Both teams would run through an interven- stance of the more general dilemma of information exchange tion and a control phase resulting in experimental between- (cf. [16]): A developer must constantly chose between im- group and within-group designs. Surveys using question- plementing new functionality, and spending efforts on in- naires were scheduled with each team at the end of their formation exchange. Writing helpful source code comments intervention period to capture qualitative and quantitative and thinking about the effect for readability of every single information about the gamification. Furthermore, partici- keystroke does not work on autopilot [48]. Developers sub- pation in customer meetings and feedback from the project consciously weigh up motives like time pressure, cognitive leaders enrich our perception of what happened during the effort, and joy of creating new functionality against other experiments (see Section 4). motives like the desire to conform to management expecta- Evaluation of the experiments shows a clear effect of the tions, pro-social information exchange and the satisfaction interventions in both teams. Both teams invested the efforts of achieving quality. According to psychological theory, fac- necessary to achieve the designated convention compliance. tors weighted by personal expectations and beliefs, sum up The game elements had the desired effects, and feedback on the pro and con sides of the decision. The developer will from the developers suggests that the investments in con- decide for the alternative with the greatest expected valence. vention compliance were worth the efforts (see Section 5; Developers will disregard information exchange, when its threats to validity are discussed in Section 6). expected valence is lower than that of other activities. A Coding conventions are widely recognized as a means to social dilemma then commences, if it is still valuable to the improve the internal quality of software. Much work has team as a whole. And indeed, the value for the sending been put into conventions, commercial tools relating conven- developer is lower than for his audience: A developer who tion compliance and technical debt, and the enforcement of wrote the code himself, will have a deep understanding of conventions with techniques like reviews or strict tool-based its functions, inner workings, side effects, and constraints. enforcement. We compare our work to such approaches. He will not need to read that knowledge from the code; at The advantages of our approach are relatively comparably least not in the near future while his memory has not faded low efforts