This week, I have an interesting lab based on project I did last week, which is a program converting .txt files to .html files. I need to review and change my partner code in order to implement a feature that supports converting .md files to .html files. Same as last week, I worked with Thanh Van.
It was hard for me at first because I work in C++ environment and my partner works in JS environment. It takes me some time to understand how his code works and how I would be going to write code in JS language. I made a small change in his structure. If the files go in is a markdown file, it will go into a separate function to handle. Also, I have a small function using expression to convert all heading 1 in the file to h1 tag in html. At first, I imported library 'marked' and use it to convert. My partner said I need to change in order to implement 1 feature for this lab only. So I went back, changed the code, cleaned it up and requested for the second pull requests.
You can take a look at the following tasks I have done on my partner's project:
- Project Repo: https://github.com/tcvan0707/txt2html
- Issue: https://github.com/tcvan0707/txt2html/issues/2
- Pull Request: https://github.com/tcvan0707/txt2html/pull/8
In contrast, Thanh also had hard time to figure out how to write code C++. He also wanted to add a heading 1 feature to my program as well as accepting Markdown input files. I refused his first pull request because he misunderstood how each variable in my program works. We had a call for an hour to discuss how the program works. It was interesting for both of us to talk to each other nicely. I reviewed his code carefully and he did a great job on the second pull request. You can take a look at the following task he has done on my repo:
- Project Repo: https://github.com/kiennguyenchi/potato-generator
- Issue: https://github.com/kiennguyenchi/potato-generator/issues/2
- Pull Request: https://github.com/kiennguyenchi/potato-generator/pull/4
Overall, it is interesting to go over and change the code that I haven't write it from scratch. This is a difficulty to me at first and also an experience to me. Also, it is amazing that someone can be able to change my code and make it works.