OSD600 Release 0.3 Telescope

Tony He
Tony He
Nov 17, 2019 · 3 min read

For release 0.3, I work closely with a classmate to develop a function to count the number of blog posts from different domains and the test for it. The issues are listed below:


This is the first time we work on a project working with blog feeds. We took some time to investigate the code we had so far and found that someone had already written a function to get all blog feed urls from the website. So we decided to use the same format of this function output as input to our function, which is an array of json objects with one property “url”.

We wanted to get the result that has the domain names and number of times it appears in the feed urls. We decided the output to be an array of json objects like below:

[  { name: 'wordpress.com', count: 2 },  { name: 'medium.com', count: 1 },  { name: 'blogspot.com', count: 7 },]

Soon we realized that we need a function to get the domain name based on url, so we used url.parse function to get the hostname and remove the user name portion so that only the domain name is remained. The core function loops through all feed url objects, parse to get domain names. For the first object, it automatically pushes into an array with count equals 1. For the remaining objects, it first testes if the same domain name already exists in the output array. If yes, add count by 1. If not, push a new domain object to the array. The function finally returns the domianSummary array that can be used for further analysis.

For test, we simply created a sample input and expected output, and use standard expect function to check if result matches the expected result.

test('Count domains from blog posts', () => {

Pull Requests

The pull requests are listed below and they both got merged. Further improvement may be needed.

Lessons Learned

This is my first experience working on an open source project with a group of people using standard processes. To get our code merged took a lot more effort than I expected. First, the code needs to pass automated testing for formating which force us to follow eslint format of javascript code. Second, the code needs to be easy to understand for future potential maintenance which means it needs to be properly commented, minimizing duplication of code, as well as following other best practices. For example, initially we used for loop with index variables instead of foreach loop for array object. The code reviewer asked us to change to use foreach loop as it is easier to understand. Last, working with many people simultaneously requires strong git skills. The upstream master branch is always changing, we need to pull the recent update and rebase our own branches before submitting pull request.

Overall, it is a valuable experience to work on a project that is similar to real work. It made me think to put more effort to improve code quality including formatting, how the code is organized as well as making statements more understandable. Looking forward to working on more issues for the telescope project in release 0.4.

    Tony He

    Written by

    Tony He

    Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
    Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
    Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade