DEV Community

Cover image for Rewriting Chess.com's Android App
Tony Robalik
Tony Robalik

Posted on • Originally published at chess.com

Rewriting Chess.com's Android App

Chess.com's Android app, which is used by about three hundred thousand people daily, and a million monthly, and who speak over 69 languages, is getting a rewrite!

Now, you may well ask "but your rating on Google Play is 4.4 stars, your crash-free rate is 99.97%, and you're profitable -- why go through all that effort?" First of all, thank you, it's good to be appreciated. Second of all, you would not be surprised to know that our CEO, Erik Allebest, had the same questions. Here's what I told him:

We are currently planning a radical redesign of the app (oh, by the way, we're planning a radical redesign and you should BE EXCITED, because it's great), and after months of hovering my finger over the "send" button on an email I spent way too much time on, I finally concluded that it would simply be impossible to get there incrementally. Chess.com has big plans for its mobile apps (Android and iOS), and the Android team determined that the best, safest way to get there was to start from scratch.

The current app works really well, but it definitely has its quirks ("that's not a bug, it's a feature!" -- you know), and it's sometimes a challenge to add new features. As a company, we always want to be using the latest stable technology and, to be frank, the existing app had its first commit to version control in January of 2011! I'm not actually sure when the first line of code was written, but the app was compatible with Android 2 (or was it 1? No one remembers). Android 9 is coming out this year. I think it's safe to say that a project designed originally for Android 2 can't be considered the "latest stable technology."

Let's all take a moment to pay our respects, however, to a mobile app that has truly stood the test of time. We haven't always been perfect, but we've always been committed to improving the experience for our players, offering them new features, and giving them what is arguably the pre-eminent live chess experience on mobile.

Now with that out of the way, what will the future look like? It's a moving target, but here are a few things I know for certain:

  • The new app will be completely redesigned, and it will be gorgeous. Material design, slick animations and transitions, faster, and generally just a delight to use.

  • The new app will have a minimum required Android version of 5.0 / Marshmallow (minSdk 21 if you're an Android dev). We project that this means 5% of our existing base of players will not be able to upgrade on their current devices, and we're really sorry about that. For the other 95%, though, this will mean a smoother experience using better, more feature-rich technology. And it also means we'll get the new version done faster, because we won't have to work as hard to support older versions of Android.

  • The new app will be written primarily in the Kotlin programming language, instead of Java. I admit I was skeptical about Kotlin for a long time (I prefer stability above all else), but when Google announced support for the language as a primary language alongside Java, I had to jump on board. Why? Kotlin makes whole classes of bugs simply go away. Kotlin is way less verbose than Java, meaning my team is more productive. Kotlin has extension functions, meaning I can extend the API of some class with missing features. Kotlin makes immutability super-easy -- see above point about doing away with whole classes of bugs. I could go on -- and I will, in a future post.

  • The new app will have proper dependency injection with Dagger2 and its dagger.android package right from the get-go, rather than jamming it in with a crowbar 10 years after the fact. What does this mean? It means improved testability (and therefore stability), better memory management, and a clear separation of concerns between object creation and object use. I will be writing a much more technical post about this later -- stay tuned!

To reiterate the first point, what we're really focused on here is a better experience for our players. Even the most esoteric technical point is about improving that good ol' UX. I hope you're as excited as I am, and I welcome you to follow along with the Chess.com Android team's adventures, as we rewrite a two hundred thousand lines-of-code app for the modern era! Thanks.

Top comments (19)

Collapse
 
ben profile image
Ben Halpern

I love this post. Really great primer on how this process comes to happen.

Collapse
 
autonomousapps profile image
Tony Robalik

Thank you! I was worried it might come across as promotional, but really I'm just excited to get to work on a greenfield project and do things "right" from the start.

Collapse
 
ben profile image
Ben Halpern

Nah, great overview. It's not like you're out here pushing stuff on us. Everybody here writes code for some company and it's natural to make it part of the story. As you've done here, when your intentions are to write something useful, it comes across.

Collapse
 
rhymes profile image
rhymes

BTW it would be awesome if, from time to time, you were able to update dev.to with the progress of the rewrite (barring trade secrets obviously :-))

Thread Thread
 
autonomousapps profile image
Tony Robalik

I intend to! I'd like to publish every couple weeks. I have several planned posts, including: Kotlin, Moshi, dagger.android, Room, the Paging lib, static analysis & CI, etc etc....

Thread Thread
 
chrisvasqm profile image
Christian Vasquez

I'm super interested in this!

I'm currently redoing all the exercises that are part of Udacity's Android Basics courses with Kotlin and I bet I can learn a bunch from you :)

Collapse
 
rhymes profile image
rhymes

Terrific story and good luck for the rewrite :-)

Collapse
 
surajdubey profile image
Suraj Dubey

Are you also planning to adapt Android Architecture Components while re-writing app? What architecture does Chess.com use now(MVP/MVVM/MVI or something else) and planning to make architecture change?

Collapse
 
autonomousapps profile image
Tony Robalik

Heh, great question. The current app, as noted, has been around for a while. So, for various reasons I won't go into, it's largely a Big Ball of Mud. Over the past couple of years we've engaged in a huge refactoring effort to convert parts of it to a hand-rolled MVP pattern, but it's been hard going. Moving forward, we're adopting the new Android Architectural Components with ViewModels, Room, LiveData, etc. We already have a few features in the current app utilizing this pattern, and so far, we're really impressed.

Collapse
 
ryry_02 profile image
Ryan (he/him)

Great intro post! Really looking forward to the future posts about the re-write of one of my most used Android apps. Especially as I'm starting to dabble in Kotlin myself. Nice work 👍

Collapse
 
jokerwin profile image
José Silva

Excellent post Tony. I usually play on chess.com website but I also have the android app and it's great! My question is how are they planning on minimizing the delay between moves?

Collapse
 
autonomousapps profile image
Tony Robalik

Do you mean between the current version available in the Play Store and the rewrite version? We're continuing to update the current version for a few months, most likely, with several big features nearly complete and ready to roll out to our beta community.

Collapse
 
goku132 profile image
Michael

Great post. Really looking forward to the new app.

Collapse
 
germanviscuso profile image
German Viscuso

Are you using an agile framework like Scrum for development? If not, are you planning to use one for the app redesign? Just curious!

Collapse
 
autonomousapps profile image
Tony Robalik

We actually already employ a modified kanban process, which we'll be continuing for the rewrite project.

Collapse
 
gameoverwill profile image
Wilfredo Pérez

Wow I use a lot chess.com Android app and I can't wait that you start to share the process of the new one. Feel free to contact me as a tester :D although I'm a very bad player I love this game.

Collapse
 
autonomousapps profile image
Tony Robalik

Hahaha... I'll see what Hikaru thinks ;-)