Completing the first milestone of my GSoC Project with Oppia

Completing the first milestone of my GSoC Project with Oppia

I have passed the first milestone of Google Summer of Code 2020. It was a wonderful experience working with Oppia. I wrote this post to share the things I've learnt during these awesome four weeks.

So first of all let me tell you a bit about my work.

The Oppia's codebase is being migrated to Angular from AngularJs and is currently in a hybrid state. Due to that the codebase shifted from Javascript to Typescript. When the javascript files were being converted to Typescript. In some places the types were not declared and were left as any. There were many reasons to that one of them being the absence for proper conventions for the types.

Also, there were some third party libraries that didn't have type definitions. So, to be precise my work in the first milestone was to

  • Write type definitions for the third party libraries that didn't have those.
  • Coming up with a convention for declaring the types.
  • Declare types for about 50% of the typescript files.

Writing definitions for the third party libraries was a bit time consuming but was not too difficult. The one thing that I learnt about typescript during this task was Namespaces.

Initally, I planned to camelize the response of all the API endpoints. So, that the typescript files could have everything in camelCase. But soon realized that it was not feasible. Then after discussion with my mentor and Oppia core mantainers we decided to restrict the use of snake_case to certain typescript files. I learnt how important conventions were to ensure a readable and maintainable code.

After the conventions were finalized it was not hard to declare types in other places in codebase. But in some places where the types could be complex. I learnt some awesome things about typescript like Union Types, Type Guards, Discriminated Unions, Conditional Types.

I was able to complete the above tasks well before time (because I started the work bit early than the official date ;))

Summing up, it was a month full of learning and I am looking forward to working on the second milestone of my project.

My Pull Requests To Oppia

GSoC Project