IlIllII / collecobrary

Making online learning fun and easy.
https://shapesofknowledge.io
MIT License
103 stars 5 forks source link

Clean up code #13

Open IlIllII opened 3 years ago

IlIllII commented 3 years ago

I hacked this project together really quickly and so it is kind of messy.

An improvement would be to refactor the code. Many of the Vue components are mammoths containing multiple things, such as a header, body content, and a footer. We could extract these pieces of code and put them into modular components where possible. This would make the code both more readable and more reusable.

Additionally, I have a lot of methods registered in some components. These walls of code make the component hard to understand. It would benefit from being extracted to a separate file and imported rather than being written in the component itself.

If you wanted to do this, be sure you write good docstrings for the functions so the import makes sense to others; I have written very few comments so far.

Where to start

A good starting point would be extracting the legend. Currently the code for the legend is in the DegreeMap component. We could extract this to its own component and then register this component in the DegreeMap.