The Gamification of Software Development

Pankaj Khushalani
Developer Students Club, VJTI
5 min readDec 17, 2021

Preface

Remember the first time you solved a programming challenge? For me and most of the people, it was ‘Life, The Universe, and Everything’, wherein we accept user input till 42 is received. Even if you aren’t acquainted with the said problem, what’s common in all programming challenges? You get a problem statement, the sample test cases, and a program that you need to write to pass all the test cases and get a full score. For me, understanding the problem, incrementally getting to the optimal solution, and clearing all the test cases seems like a game. You level up with each problem solved, improve your rank, move up the leaderboard, it’s a real-time game, or what we call gamification — the addition of game elements to a non-game environment.

The Traditional Software Development Process

Consider that you are developing a to-do list application. You ask yourself, what are the minimum functionalities that a user would expect from your to-do list? Creating, reading, updating, and deleting a to-do, or simply put — CRUD operations on the to-do item would be expected. Now that you have the features listed, you start developing these step-by-step.

Fast-forward a few hours and you have developed your to-do list successfully. However, it’s time to introspect. Can your application handle empty user input, what is the maximum user input, what about duplicate to-do items? There are several edge cases or errors that you come across after building the app. So you go back, debug, refine your logic, and use your app again, maybe even write some tests.

A few days later, you realize that there is another bug or edge case that you did not resolve. Now, we come to the realization that software development is an iterative process — develop, build, deploy, repeat. We make incremental changes only after deploying the new code. What if we could do this multiple times before shipping the new code? Unlike programming challenges, there aren’t any test cases here that are served hot for you. How about YOU create those test cases?

Introducing Test-driven Development

Entertain this idea for a bit — writing tests for the code that you haven’t even written yet! This code can be as spaghetti as you want it to be because after you write code that passes all your pre-defined test cases, you start tidying up your code. Now you’d think, why would any sane developer even consider doing this?

You would be surprised to learn that this technique of writing code is prevalent in the industry and is known as test-driven development (TDD). Recently, I came across Learn Go with Tests which is an amazing way to learn the Go programming language using TDD.

Art by Denise Yu

Here’s how one proceeds with TDD in what is called a Red-Green-Refactor cycle.

  1. Red: You write tests for the code that you have to implement even before writing that code. Also, you have to make sure that the written test case fails.
  2. Green: You write just enough code that will pass all the test cases. This code does not have to follow the best practices or use some design pattern. The focus here is to accomplish the task of writing code that works.
  3. Refactor: This is the phase where you clean the mess that you may have made. Here, you spend time improving the quality of the code.
The micro-cycle of test-driven development, illustrated by Evan Cole

Now you would’ve gotten the idea of gamification here. You set the levels (test cases) for yourself. You play the game (write code) to complete these levels. Then, you go back to them to improve your score in each level (refactor). But are there any other benefits of following this tedious process?

A study by North Carolina State University done on Microsoft and IBM teams showed that they produced code that was 60–90% better in terms of defect density. This is because TDD gives more importance to testing as a means to solve the problem. Even if you don’t know about the testing framework in your language of choice, you can pick up TDD to get better at testing.

Where else can you find Gamification?

Fret not if you don’t know testing. There are others means to gamify your software development process.

  • GitHub: Who doesn’t like to bask in that green glory of that contribution graph? I don’t think I am the only one who has tried to maintain a streak or tried to cross some contributions in a week. Try it out, it’s fun!
GitHub contribution graph art by Annihil
  • AWS DeepRacer League: This is machine learning gamified wherein you develop a reinforcement learning model for a real-life model car to participate in a racing league.
  • Battlesnake League: A board game where you code your battlesnake with simple logic or even AI to complete and climb the top of the leaderboard.
  • CSS Battle: Improve your HTML and CSS skills as you compete with developers worldwide.

There are numerous resources that I could list here or different ideas that could give you the illusion of playing a game as you develop your new application. Heck, you could even consider yourself playing Pokémon as you go on collecting skill badges for the 30 Days of Google Cloud program or the Android Study Jams.

What I’d want you to take away from this article is that when you think of developing your next application or learning a new technology, try to find that element of a game that will make the process more fun; to get the same thrill as you would in that programming contest.

--

--