DEV Community

Gustavo Tavares
Gustavo Tavares

Posted on

Reviewing Someone's Code! - OSD600 - Lab 01

Hey,

This time I want to talk about my first experience reviewing someone else’s code. My friend for this adventure was Andre Willomitzer. I found him not through our slack channel, but he contacted me personally as we know each other for some semesters already.

This lab was really interesting, because we used the same language I though our code would be similar but instead we had a lot of different logics and different optional features implemented.

What I found checking Andre’s Code:

textToHTML

“npm install” not working.
His json packages were not working properly, to make it work I had to install yargs manually.

Check if -i input is present. If not, handle the error.
In his program, when running it without -i arguments like: ”node textToHTML_V2.js -i ”, the program was breaking.

His program was accepting only one argument as input.
While in the release 0.1 note step 9, it says that “your tool should generate one .html output file for each input file.”. If I entered as input two .txt files, only one was generated. He claimed this was a feature, but in my opinion, it didn’t meet the release 0.1 step 9.

Feature -o accept only folders on the project folder. Folders in another directory are not working.
The -o option only worked for directories inside the root folder, if outside like in the Desktop, then the program would break.

Check if -i input exist. If not, handle the error.
If I use an inexistent file as input for his program, the program will break.

What Andre found on my code:

GMOT-SSG

On his end, while review my project he also found some bugs on my program:
I had an unused variable on my code.
The title of my files was coming from the first line of the txt file instead of the file name.

He also suggested an improvement on my -o feature, to create an output directory in case it didn’t exist, besides not being a bug, I decided to implement it while correcting the other bugs.

Conclusion

This lab was really interesting, seeing how other people use different logic for the same problem is makes programing even more interesting. How many ways there was to make a program like this?

Besides some bugs, Andre’s program was transforming a single .txt file in HTML file with paragraphs inside

tags as intended and when working with a single directory, it would do the same with each file as intended. Options like -v for version and -h for help also were working fine.

Thank you for reading again!

Discussion (0)