Pre GSoC : A Competitive Programmer’s experience
Google Summer of Code (GSoC) is a summer program by google that brings open-source organizations and students together to work on open-source projects.
This blog is my experience about how I started open-source contribution (with the motivation provided by GSoC). This includes the bugs and features I have worked on so far in addition to the way competitive programming and open-source affect me. The blog might have some new terms. So stay steady with me till the end and… let’s get started.
$ whoami (as on 26th Dec 2020)
Hiya fellas! My name is Santhosh and I am pursuing my graduation in NIT Bhopal. I am a linux user and a competitive programmer with c++ as my primary language. I have no idea about opensource and version control system. Today, I found about GSoC while surfing online. After reading a lot of good responses about GSoC and opensource, I thought to give it a try .
And I just made one of the best decisions in my life.
Week 1 : Picking the organization
The starting weeks were mostly reading documentations. Firstly I had to choose which organization to pick before starting my journey. I found KDE and decided to start with KDE because of its large community, availability of c++ projects and most importantly I was a kubuntu user.
Week 2 : Knock Knock KDE!
I have gone through the documentation to start contribution. I had a lot of downside while creating my development environment (facing a lot of new terms like Qt, cmake etc). I hesitated (enjoy it while you can, you won’t have it longer) to ask the developers but eventually I did and they gave a friendly response. Later I was able to successfully build KDE applications. However to understand the code, I realized that I should do some homework.
Week 3 : Hello Qt!
Qt is a framework written in c++, that is used for developing GUIs and multi-platform applications. Some of the popular softwares like VLC, Spotify, Google Earth are made with Qt. Most of the KDE applications are built using this framework. So I started learning it. Qt documentation is the best way to learn Qt but it might not be beginner friendly. The book “Mastering Qt5” helped me to start with Qt.
Week 4 : The Git begins!
Now that I was able to understand the codebase, I should learn the legendary git to start contributing. The best way to learn git is by doing git. This link provides a nice visualizing tutorial to git.
Week 5 : My first ever contribution
Open-source projects usually have starter bugs tagged with “junior jobs”, “good first issue” etc. This is when I have pushed my first contribution to the world of open-source. It was about improving the quality of icons of KdeConnect in Hi-Dpi devices. Moreover, it was only 2 lines of code (yes! that’s how it started). Usually it takes some time for the developer to check the patch. Luckily, the developer was active at that moment and they merged my patch instantly.
And my code is officially open-source
Week 6 : Expanding my territory
Now I started to explore other projects of KDE as well. Krita is a professional digital painting platform. By the first sight, I was scared and fascinated by it’s large codebase. I researched about Krita and decided to go for it.
Week 7 : First Merge Request(MR) in Krita
I asked in the IRC(Internet Relay Chat) about any beginner works that I could put my hands on. Krita(community) has generously responded by giving a link having some beginner tasks. So, the first feature I worked on was to provide shortcuts for toggling “brush smoothing options” on and off (something like Ctrl+B). The feature was asked by a user.
I remember how I felt when I wanted a feature in some application. Now I am on the other side of the table.
I have implemented the feature and pushed the MR. After a few modifications it got merged and I heard from the user who has actually asked for it. I couldn’t be much happier .
Week 8 : Getting Involved
The best thing about open-source is communication. Krita developers conduct weekly meetings in the IRC room where anyone can voluntarily talk about the work they’re doing along the week. It helped me to make a connection with the software. In this week, I worked on setting default ‘colorspace’ while creating a new file. We discussed about various regressions in my work and then I did some modifications. After few such cycles, the patch(MR) was successfully merged.
Week 9 : Slow down Kiddo!
It felt like things were running little quick around me. This week I was working on the following case: “A brush in Krita has several settings (like brush size, tip shape, opacity etc) which can be temporarily changed without saving. Now while renaming a brush, the brush gets refreshed and these temporary settings are lost (which was not intended).”
To solve this, I was digging through this huge codebase (from the way the gui is updated to the way everything is saved in the device). I tried a lot of methods and after a lot of effort I felt like giving up. I shared all my work with a krita developer and then she told me that I was very close to fixing it (as close as adding a header). Anyone would fall in love with open source if such incidents happen ( opensource).
Week 10 : Hibernation
This was my mid-semester exam week. So this week was mostly reading the bug reports on Krita and skimming through the codebase (and IRC).
Week 11 : Another week another patch
Crop Tool in Krita has an option to lock width to height ratio of crop selection. The bug was about a corner case where this lock was not followed. It involved getting my hands dirty on the algo (Oh! I love it). Worked on the bug, pushed the MR, had some chat and the patch was merged (uff! what a lazy me).
Week 12 : Rejuvenation! (or just a lazy week)
This week, the other side of me was awaken and started to seek the other side of entertainment. Thus the whole week was dedicatively dedicated to some movies and the anime “One punch man” (in addition to usual quota).
Week 13 : Levelling Up
This is getting to another level now. Krita has rectangle and ellipse tools to draw respective shapes. There was a feature request reported about the ability of rotation to these tools. This could provide a lot of flexibility to artists to draw rotated rectangles and ellipses, especially ellipses (could be a workaround for perspective ellipses). So I decided to work on that.
Alright now! For this feature I had to think about the way UI should work (community discussion helped me with this), and the idea upon which I had to implement this feature. Moreover, I had to see that it works without breaking any existing feature (like drag transformations, size constraints etc).
With a lot of mind trekking and braingee jumping, I wrote a decent code and checked it twice. Everything was good and I build the application successfully. But when I tried to draw a rectangle, it was drawn with an entirely different size, angle and position. Not a single parameter had a resemblance (oh wait! It was still a rectangle). I had literally hit my head to the wall.
Later when I was able to manage my hysteria, I sat back and checked my code again. Then I figured that there are many symbols other than a semicolon that could make a developer’s life miserable. I kept on debugging and testing. After a few cycles, the feature was suddenly working like a masterpiece. I was shouting in my head that it’s working.
I made a few touch-ups and pushed an MR. The developers liked it and were ready to merge. Then I got into a git issue. I did some googling to understand it. Somehow I fixed the issue and finally the patch was merged .
Week 14 and 15: GSoC
It’s time to think about my GSoC project. Organizations usually have a few starter ideas upon which a student can build their project proposal. Krita has many areas open to develop (kudos to its users for their reports). Again with community discussion and codebase skimming, I chose my project for GSoC.
The template provided by the organization helped me to frame my project proposal as well as my idea. I made my proposal and shared its draft. The developers responded and a few regressions in my timeline were fixed. On the final date of student application phase, my proposal was locked successfully.
My start in the world of open-source has been very beautiful with KDE and Krita. I have experienced fun in coding and seriousness towards the project simultaneously.
I realized that the whole community was a few steps away waiting to help me. All I had to do was to take them and tada! I am an open source contributor.
Open Source and Competitive Programming(CP)
It is not an unlikely scenario to choose between CP and open source (especially for a student). CP and open-source are two different worlds that one can thrive in independantly. But they need not be mutually exclusive. In my case, I am enabled by open-source in a better way with the competitive programming mindset and open-sourcing has made my problem solving more structured. So if anyone asks me, I’d say go for CP and open-source (have the best of both the worlds).
As a final note, I am selected for GSoC’21. The true journey is just begun.