This is my final blogpost regarding GSoC 2020 and I will try to summarize everything I managed to accomplish while working on this amazing project. I think everyone will remember the summer of 2020 for their entire lives because of the stuff that happened this year but for me it will be extra memorable because of this great journey.
In my proposal I planned to dive right into the toughest parts and start refactoring them but there were some open issues that needed to be merged before I could start refactoring. So in our first meeting we decided I should start from documentation first and then get into refactoring. This was a blessing because while documenting I learnt that there were some assumptions I was going to make while refactoring which were baseless. For documenting each file, I used JSDoc. JSDoc can auto-generate HTML pages for Documentation based on comments in files which gives more meaning to comments and also leads to an easily readable and navigable Documentation. I started off with files that I had read about a hundred times during the research period and proceeded to ones I never felt the need to read before. It was a good learning opportunity because now that I have documented each and every function and I know (or at least I hope I do) what every function does in those 34 files with 30k+ lines. I have added at least 2400 lines of comments and fixed some linting issues. With a PR of line difference 13323, even the code climate bot has given up. link to the documentation.
After documentation in week 1 It was finally time for me to start working on refactoring and updating the JS codebase in CircuitVerse. I had spent most of my research time researching and refactoring the codebase so at least 10–20 percent work was already done. I started working on making separate files with default exports for most classes and object literals. Tried to move some global functions to appropriate files, changed some variable names which were not following camelCase. I also fixed some listing issues. In my official proposal, I have given myself a time of 4 weeks to refactor the whole codebase. But since I have learned a lot while documenting so I didn’t need to do research on some particular functionality before refactoring it, I did it in 2 weeks.
and much more, Here’s the link to now merged PR: https://github.com/CircuitVerse/CircuitVerse/pull/1468 (please be patient the PR got very large and so the link crashes sometimes because response takes too long xD.)
And then I got my first evaluation
In the second phase of my project I worked on:
Making a separate repository for CircuitVerse-Simulator code.
Completed testing, added tests for all elements and some more UI corner cases.
In the separate Repository I set up webpack (initially all work was on webpacker gem in Ruby on Rails) Then I made adjustments for an environment in which a developer will be able to make changes and implement features easily. There is a UI revamp project which ended just and I will be working on merging the UI changes to this repository and after setting all this I plan on adding this as a submodule to the rails app repository.
Also I set up testing for simulator these tests are written in JEST and I have automated github action to test the newest code pushed onto master or incase there is a new PR on it. Report on these test can be seen here I am hopeful all these test, refactoring, documenting and linting will make it really easy for future contributors to pick up and implement new features into the simulator which was probably the hardest part of trying to contribute in CircuitVerse.
The third phase was the electron app. I used the same repo I separated in phase 2 as a submodule and modified it to do some web specific stuff differently using isElectron module. The electron app has all the features that the online simulator has but the save offline feature actually saves stuff offline in your file manager instead of browser localStorage. You can open this code online and you can also save circuits online from save offline feature.
The separate repository can be found here
With an offline save, online save, and basic editor menu options.
After GSoC I will be working on integrating the new UI work (which has been done for the simulator) with the offline app and moving the current codebase to a separate repo officially. I will also be helping in the work left on SubCircuits.
I was able to achieve my proposal well before my proposed timeline and I learnt a lot in this journey. I would like to thank Satvik who taught and helped me a lot. He was always available and cleared all my doubts everytime despite being busy and working himself. Also I am grateful to Google which paid me for something I love doing. The whole process is great and the whole Open Source community is very helping. I just wish I can give back enough to a community that has given so much to me.
Thanks for reading this.