A Card Game for Learning Software-Refactoring Principles
Total Page:16
File Type:pdf, Size:1020Kb
A Card Game for Learning Software-Refactoring Principles Thorsten Haendler University of Applied Sciences BFI Vienna Institute for Information Systems and New Media, WU Vienna [email protected] ABSTRACT coding, software-design principles or handling of the program- While software refactoring is considered important to keep a ming environment (e.g. the testing framework). software system maintainable and extensible, it is often ne- For refactoring a certain kind of code smell, often different op- glected in practice due to several reasons. Besides the associ- tions and paths are available [9, 37]. Being aware of multiple ated costs, software developers often perceive refactoring as a (or all) options available (in best practices), gives the software difficult and risky activity. However, apart from textbooks that developer advantages regarding flexibility and efficiency in document rules and best practices for identifying bad smells problem solving since she then can choose the best (e.g. the and applying appropriate refactoring techniques, learning and easiest or most elegant) out of multiple options. Moreover, teaching refactoring poses multiple challenges. The applica- it is essential that software developers are aware of the value tion of these rules and techniques to code examples requires of software refactoring and are able to apply refactoring tech- (advanced) skills in programming as well as an adequate han- niques in a meaningful and efficient way by weighing costs dling of the programming environment. These circumstances and benefits for the software project. can distract the focus and set barriers to the introduction of refactoring. In this paper, we present REFACTORY, a non- Educational games aim at fostering practical competences digital multi-player card game for learning principles of soft- and motivation by providing a playful and interactive environ- ware refactoring without the development-related complexi- ment [26, 18]. As found out by [21], around 90% of games ties. In our game, the players simulate a software-development for software-engineering education are digital games, which team confronted with bad code smells. The players learn to means that they mostly provide a simulation of development combine refactoring techniques to remove the smells and to activities and are played against the computer (for examples, balance costs and value of refactoring. We specify the game see Section2). In general, non-digital card and board games design and illustrate the game workflow. In addition, expe- allow for focusing on selected conceptual aspects, have lower riences and lessons learned from a first game-play study are entry barriers and provide the benefits of face-to-face and presented, e.g. regarding game fun and mediation of compe- informal interactions between players [21]. tences. Finally, we discuss limitations and further potential for improving the game. In this paper, we present a non-digital card game called REFAC- TORY for learning principles of software refactoring. In partic- ular, the objective of the game is (1) to motivate the players Author Keywords for learning more about software refactoring and (2) to medi- Card game, software refactoring, serious game, game-based ate basic refactoring-related competences in terms of being learning able to conceptually combine refactoring techniques to remove bad code smells as well as reflecting the balancing of costs INTRODUCTION and benefits of applying software refactoring. The proposed Issues in software artifacts such as code, design or architecture learning environment supports active and game-based learn- can cause technical debt (TD) which can negatively impact ing, especially suitable for novices that have little experience a software system’s maintainability and evolvability [24]. A in software development. By focusing on the conceptual level popular technique for removing these issues (such as bad and certain aspects of refactoring, development-related com- smells) is software refactoring, which aims at improving the plexities are avoided and the entry barriers are low. The basic internal quality while preserving the observable system be- idea is to confront players in the role of software developers havior [30,9]. But software refactoring is a complex activity with a software system that is affected by several bad code involving several challenges and which is often perceived as smells (technical debt). In multiple sprints, the players then difficult and risky by software developers [38, 12]. In recent aim at increasing the system’s value by realizing functional- years, only a few approaches in software-engineering educa- ities. The players then have to decide whether to realize a tion addressed the need for software developers competent in functionality, which is more time expensive, when the cor- software refactoring (see e.g. [35, 17]). Most have in common responding component is affected by smells, or to remove that they require a high level of entry skills, e.g. regarding the smells beforehand by applying refactoring techniques. In particular, this paper provides the following contributions. GamiLearn@CHIPLAY, August 22, 2019, Barcelona, Spain Copyright ©2019 for this paper by its authors. Use permitted under Cre- ative Commons License Attribution 4.0 International (CC BY 4.0). 1 game preparation game board (software system) legend subsystems sub1 sub2 sub3 Px player (developer) S assigned to players S bad-smell card S F S F S F S smell cards R refactoring card assigned to S F S components E event card sub sub sub 4 5 6 F functionality card first set of S R S S S refactoring F subx sub-system cards given F S component to players F S S F S chance factor 2 I. (dicing) R F II. 3b round R F (sprint) R F each player can 3c 2a invest time to a player draws an P2 II. eventually E I. remove smells and/or introduces event card * P1 II. realize functionalities P3 new smells (done) F functionality cards are assigned to players' 3 player's move player's score sheet components (todo) 3a sprint 1 2 3 4 ... note time and each player draws 2b functionionality a certain amount of R time a certain amount of todo time points is attributed value refactoring cards 3d update of to each player todo/ done time, value, done Figure 1. Game constellation of REFACTORY. • We present design and workflow of an educational card and learning context), the game design (e.g. concepts and game addressing basic competences in software refactoring, mechanics) as well as the workflow and variants of game play. such as combining refactoring techniques to remove bad Then, we report first user feedback in terms of the results of code smells and strategic aspects like balancing costs and a small game-play study (see Section4). Section5 reflects benefits of performing refactoring activities. the approach’s limitations and further potential. Section6 • We discuss user feedback in terms of the observations and concludes the paper. results of a short game-play study based on a prototype of the card game. RELATED WORK In recent years, several (educational) games have been pro- Fig.1 illustrates the game constellation of REFACTORY.A posed in the field of software engineering such as approaches game board represents a software system consisting of multi- for game-based learning, serious gaming and gamification; ple sub-systems (each comprising multiple software compo- see e.g. [6, 32, 21, 26,2]. Among these gaming approaches, nents in turn), which are assigned to players at start (see 1 in closely related to our approach are in particular games for soft- Figure1). Goal of the game is basically to increase the value ware refactoring on the one hand and educational card games of the given software system by realizing new functionalities on the other hand, which are both discussed in the following. assigned every sprint [36] (see 2 ). However, the players are impeded in realizing new functionalities by pre-existing issues Games for Software Refactoring in the software design (see 1 ), which complicate the mod- For the sub-field of software refactoring, only very few ap- ification and extension of components and thereby increase proaches of (educational) games can be identified. Based on development time. These bad smells can be removed by apply- the systematic literature reviews [26, 32,2] and further re- ing certain combinations of refactoring techniques (see 3 ). search, the following gaming approaches related to refactoring In addition, events (such as code reviews or a feature check can be identified [34, 33,8, 20, 16,3]. For an analysis of from the customer) impact the value scores (see 2a ). Further refactoring games, also see [15]. Among these, serious games details on the design and game-play workflow can be found in and gamified (editor-based) development environments such Section 3.3. as [8, 16,3] provide realistic or real-world development con- The remainder of this paper is structured as follows. Section ditions enhanced by gaming elements to motivate the software 2 discusses game approaches related to the proposed card developers. For instance, the serious game proposed in [16] game. In Section3, our game REFACTORY is explained in supports several single and multi-player game modes striving detail, including the targeted objectives (e.g. competences to increasing a system’s internal quality by reducing its techni- cal debt via refactoring. For this purpose, analysis tools such as test frameworks and technical-debt analyzers are integrated. focuses on strategic aspects of balancing costs and benefits CodeArena [3] is a 3D game built on Minecraft Forge that of refactoring in order to raise awareness for efficiently and allows for fighting code clones (represented as monsters) via meaningfully applying refactoring techniques. code refactoring based on an additional editor view. Related to these are intelligent editor-based tutoring systems such as [35, 17]. They all have in common that they require a high level REFACTORY of entry skills, e.g.