Arrays are one the most common data types in computer science. They can be used to store data structures including other arrays in an efficient and accessable manner. But often we run into nested data structures such as nested arrays that don’t always allow for straight-forward traversal and retrieval of their elements. Such as in the following occurrence:
Inspired by the success of Wikipedia, OpenStreetMap is a project to create a free editable map of the world. OSM is considered a prominent example of volunteered geographic information. OpenStreetMap is built by a community of mappers that contribute and maintain data about roads, trails, cafés, railway stations, and much more, all over the world. OpenStreetMap’s community is diverse, passionate, and growing every day. Our contributors include enthusiast mappers, GIS professionals, engineers running the OSM servers, humanitarians mapping disaster-affected areas, and many more.
The first part of building this CLI consisted of determining which functionality would be most relavent to the end user. Since I’m scraping Hacker News, this phase was straight-forward. Displaying the names of the articles was clearly the information that users would need the most, followed by a few other descriptors such as the upvote count, source, comments, time posted, as well as the posters username. I decided to display, what I considered the most relavent information in the following format.