DEV Community

DenisC
DenisC

Posted on

Hacktoberfest 3rd Pull Request - Adding New Feature

Hacktoberfest: Contribution Chronicles

In the previous 2 pull requests, I have been working on bug fixing either spotted by myself or by others. This time, I have worked on adding new feature to a Math Worksheet Generator Project.

New feature added

The feature I worked on was to add a front page to the generated worksheet that contains a date/name/score section, which could be useful when the generated worksheets are distributed in class. I initially saw this in the TODO section in README.md but found no related issue in the repo, so I posted an issue regarding this feature and started working on it.

Process of adding new feature

The output worksheets are in pdf format, generated by fpdf library in Python. As I have never used this library before, I have to first read documentation on fpdf library to get the basic idea of how it works, in order to implement the new feature of adding a new page. While I was planning on how to add the name/date/score fields on the front page, I also realized that it would make sense to have a title too, so I decided to add a default title to the front page, and implement a --title option to the tool to allow customized title by user. After clearly stating my planning about the new feature in the issue, I started implementing the new feature while trying to stick to the original coding style. At last, I updated the README.md to add instruction for using the new --title option, replaced the sample-worksheet.pdf with the new one with a front page, and made a pull request.

Lesson learnt and future planning

Through working on this pull request, I have become more comfortable working with tools that I am not familiar with, such as the fpdf library this time. I realized that we don't have to fully understand everything about a tool to use it, instead, we should focus on the parts we are interested in, which would be enough for us to utilize the tools. I've also learnt the importance of having a flexible coding style, such that the codes written would be consistent to whatever projects I'm working on. So far, I've fixed bugs and added new feature in my pull requests, in my next pull request, I would like to work on a different type of issue, possibly writing a test.

Top comments (0)