While working with the project, I realized how unorganized I was.
My components are all over the place in the directory, and the logic are all at random location.
I never realized this as much when I do my coding, but as I was reading reviews for my pr, it was pointed out to me
by the owner of the repo.
If it works, don't bother
I have formed a habit; if the code works as intended, and there are no ongoing issues nor bugs, that it's a "good" code.
However, that is far from the truth... a code might work right now, but it doesn't make it good. I tend to forget that technology grows, and so will any project I make that are user oriented.
Especially, when this repo is open source, and many contributors will be wanting to try their hands on it. When they want to fix a bug that may occur in the future, or some that I have overlooked during the development process; they won't be able to, or they will have a hard time just trying to understand.
Consider the area
Throughout the review process of my previous PR. The owner of the repo was providing me with insights in regards to fixing my habits.
- When all logic are spread across multiple components. Never add logic to all of them, only do so towards the parent components, and pass the output as a props that can be used by the child.
- If the code looks long, read through it all over again and see if you are able to split the code into smaller components. It might require for you to create more files, but if you group them all together it won't be an issue (sometimes quantity can lead to better readability). Of course, it doesn't mean that you should always have multiple files. However, just like how I was taught from my previous courses, if you have to repeat a logic, it's best to write a function to condense it, which in my case a bunch of components.
Learning Experience
This week has been more insightful than my previous week working on this project. I realized how to ensure that future developers and peers alike can access through my code without any issues. I also started to get better at handling conflicts with my PR.
Top comments (0)