For my first lab I was asked partner up with a peer from class, fork their 0.1 release, and then test it. My partner will then do the same for my code.
First challenge, finding a partner. I know a good few people in this class who I could have paired up with but I noticed on the slack channel that Roger Yu was looking for someone to review his 0.1 release. He wrote it in Python just like I did so I was curious to see another approach to the same problem in the same language. Since this course is all about working on the code a stranger wrote I thought it would be better to partner up with Roger than someone who I already knew and have relations with.
Getting my code peer reviewed
I was a little anxious about having a peer review my code but Roger was able to give me some good advise and pointed out some minor issues to help make my project more professional.
- I had an unused variable left over from a prior design choice that I have since removed
- There was a couple extra blank spaces in my colourText class, so to keep a consistent layout I removed them.
- My program originally had no timeout functionality when making requests so there was times when it would lag behind and seem like it was frozen. To fix this I added a 2.5 second timeout limit.
- To make my code more professional looking, Roger suggested I locate my source code in a separate file. I did that as well as added a resources folder to hold the testing files.
There is still one issue that I have yet to close that Roger created. My code lacks any documentation/comments to explain what it all does. This is because I feel like Python is a pretty intuitive language to read and my naming conventions are on point so I think the code explains itself. Also, I’m lazy…
Reviewing someone’s code
Okay, my turn to review Roger’s code. It was interesting to see the different design approach he used. Roger implemented a library that I considered using, requests, instead of urllib3 to make the HTTP requests. He also chose to add the optional threading component to his program.
After reviewing his code I posted the following issues:
- We both used the argparser library to handle the arguments passed to our program. Roger was unaware that there is a special keyword you can invoke as an action called ‘version’.
- While there was no spelling mistakes and the instructions were spot on, I made the suggestion that Roger put the prerequisites first before the usage command in order to have a better flow.
- I found a duplicate file of his ‘main’ in the repo.
- There was also an issue where, because of threading, the results from his program would display differently on each run through of the same file. It would be nice to see the same output when you run the same file.
- The final issue I found was that one of the links that should have responded with 200 came back as unknown.
This was an interesting experience and I good way to dip our toes into the world of Open Source Development. It took us out of our comfort zone by having a peer review our code because at the end of the day, that’s what this course is all about. Taking on new challenges and collaborating with people you may not know!