Yeah, I did it, 2nd time completing Hacktoberfest. It’s been extra fun working on Hacktoberfest this year (extra special coz., I had loads of fun working on a puzzle game in android).
First of all, Huge thanks to DigitalOcean and dev.to for organizing the Hacktoberfest 2019. Of course, the primary objective of my participation is to get the cool T-Shirts & Sticker and a self-gratifying of human behavior of achieving something. But along the way, I felt a bit happy about contributing to somebody’s work and giving it back to the community.
It all started with one of our dev.to community buddy Beautus S Gumede’s question regarding how to write test cases a year back.
I was much more active in ‘dev.to’ than nowadays. What started as answering to a question, led me to complete Hacktoberfest in 2018.
I started this year early. So the Hacktoberfest plan for this year is.
# Plan - [x] Identify repos to contribute (Criteria: Android, Java/Kotlin, Easy/Medium difficulty) - [x] Follow best coding practices & use conventional commits for git commits - [x] Submit PRs - [x] Get the HacktoberFest T-Shirt
Lesson 1: You can learn a lot of new things when you review a repo & fix/add things
Several of my PRs focussed on improving the existing code by addressing lint warnings & suggestions based on my experience. Most of the lint warnings are pretty evident, and the android studio can help in resolving those. The below one was something I didn’t come across and was glad to be bumped with the error. It allowed me to learn something new.
While working on the ‘MEME’ app, I came across the below deprecation as a result of running ‘lint.’
Environment.getExternalStorageDirectory() is deprecated in SDK 29
From a quick research, found out baseContext.getExternalFilesDir(“directory_name_to_create”) can be used. And from the logs, able to understand the differences of their implementation as well.
10-15 15:31:05.328 27301-27301/com.example.lenovo.meme D/Test: Directory Path: baseContext.getExternalFilesDir("Meme"): /storage/emulated/0/Android/data/com.example.lenovo.meme/files/Meme 10-15 15:31:05.333 27301-27301/com.example.lenovo.meme D/Test: Environment.getExternalStorageDirectory(): /storage/emulated/0
Lesson 2: Be conscious of the boundaries when proposing the changes & ask first
Also, one thing I learned this year was to be conscious of the boundaries & propose the changes. Although the primary goal of an owner/maintainer of a repository to get their bugs fixed, the implementation we provide may not align with what they need/requirements some times.
While working on this ‘MEME’ app, the question the maintainer was related to the UI/UX change. I had a pretty good idea for the UX flow, so I planned to work on it. However, I noticed that the app was written in Java, and as Google has been promoting Kotlin, I felt it would be better to migrate to ‘Kotlin.’ So I migrated the app from Java to Kotlin and worked on my idea and submitted PR.
But as I was working, I realized that I didn’t check with the maintainer if he wished to migrate to ‘Kotlin.’ I opened up a discussion with the maintainer, and as I expected, he didn’t want to migrate to Kotlin. No hard feelings; of course, the maintainer of a repo retains the right to decide what’s best.
In any case, I submitted the PR as I wanted to increase the hacktoberfest count (to be honest). I added the idea & shared a video of the new UX in the comments, in case the maintainer wants to take a look.
I wish I asked the maintainer before starting working on the issue if he wanted to migrate the app from Java to Kotlin. In any case, it was fun to work.
Lesson 3: Contributing is more fun when you work on a game
The most fun I had was working on this repo: Memory-Game, which was a single screen memory based puzzle game. The repository was already in ‘kotlin,’ and I got a couple of ideas of extending the concept. I proposed a simple idea of providing ‘difficulty’ and let the user choose and play. Another idea was to allow the user to start at the beginner level and increase the difficulty as he finishes each level. I submitted PRs for both, and It was enjoyable working on this app.